Skip to content

Parsing RGBA hex codes fails (feature from CSS Color Module 4) #83

Description

@rutek

When a stylesheet with RGBA hex codes is parsed, it triggers ERROR-level logs.

Quick proof from an interactive Python session using cssutils==2.15.0:

$ python
Python 3.12.3 (main, Jun 19 2026, 12:46:00) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cssutils
>>> cssutils.parseString("body { color: #00808080; }")
ERROR   PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('HASH', '#00808080', 1, 15)
ERROR   No content to parse.
ERROR   PropertyValue: Unknown syntax or no value:  #00808080
ERROR   CSSStyleDeclaration: Syntax Error in Property: color: #00808080
cssutils.css.CSSStyleSheet(href=None, media=None, title=None)

CSS Color Module 4 documents that as a supported syntax (8-digits): https://drafts.csswg.org/css-color/#hex-notation

I guess it's linked to #29 which covers a generic need to implement features from the CSS Color Module 4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions