#929

[BUG] Brand validator rejects approved palette colors in RGB and shorthand hex

OpenBichengWangopened 11d ago

Affected Notebook/File

skills/custom_skills/applying-brand-guidelines/validate_brand.py, BrandValidator.validate_colors()

Bug Description

The default brand validator rejects approved colors when they use RGB or shorthand hex notation. The bundled SKILL.md explicitly defines Acme Blue as both #0066CC and RGB (0, 102, 204), and validate_colors() recognizes RGB expressions, but it compares their literal strings against a hex-only approved palette.

As a result, a document using the documented brand blue gets passed=False and loses 10 compliance points solely because of its color notation. White similarly passes as #FFFFFF but fails as #fff.

Expected: equivalent supported color representations have the same compliance result; colors outside the palette still fail. Actual: approved RGB and shorthand hex representations are reported as unapproved.

Steps to Reproduce

At main commit a162e0184e71b60290808a43961a6cbc8060123c, run this from the repository root. It uses only the Python standard library and makes no API calls:

import sys
from pathlib import Path

sys.path.insert(0, str(Path("skills/custom_skills/applying-brand-guidelines").resolve()))
from validate_brand import BrandValidator, get_acme_corporation_guidelines

validator = BrandValidator(get_acme_corporation_guidelines())
for color in ["#0066CC", "rgb(0, 102, 204)", "#FFFFFF", "#fff", "#FF0000", "rgb(255, 0, 0)"]:
    result = validator.validate(
        f'Acme Corporation innovation <p style="color: {color}">Professional solutions</p>'
    )
    print(color, result.passed, result.score, result.violations)

Error Message

#0066CC True 100 []
rgb(0, 102, 204) False 90 ['Unapproved color used: rgb(0, 102, 204)']
#FFFFFF True 100 []
#fff False 90 ['Unapproved color used: #fff']
#FF0000 False 90 ['Unapproved color used: #FF0000']
rgb(255, 0, 0) False 90 ['Unapproved color used: rgb(255, 0, 0)']

The last two cases are negative controls: red is outside the default palette and should remain rejected. Normalizing supported color forms before comparison would allow the approved equivalents without admitting those controls.

Environment

  • Python: 3.11.17
  • OS: macOS 27.0.1, arm64
  • No third-party packages or credentials needed for this reproduction.

Activity

0

No activity yet.