Skip to content

Property Color unset invalid value #19

Open

Description

@Thokas

I'm only using this Package to validate CSS-Values, but I've stumbled upon the case where a color value is set to 'unset' and the profile validation (cssutils.profile.validate) returns a false for this.

Expected Behavior

cssutils.profile.validate('color', 'unset') is True

Actual Behavior

cssutils.profile.validate('color', 'unset') is False

Activity

  1. jaraco commented on Feb 23, 2022

    @jaraco
    Owner

    Looks like unset is a legitimate setting. I welcome a patch to fix it.

  2. Madin-H23 commented on Oct 21, 2026

    @Madin-H23

    Hi @Thokas — thanks for the report. You are right: on current main cssutils.profile.validate('color', 'unset') is False, while inherit is accepted:

    >>> cssutils.profile.validate('color', 'inherit')
    True
    >>> cssutils.profile.validate('color', 'unset')
    False

    The values are validated against the profile regexes, and the CSS-wide keywords only appear in the regexes where they were spelled out per property.

    Per CSS Values 4 the CSS-wide keywords (initial, inherit, unset, revert) are valid in place of the value of any property, so I would like to accept them for every property rather than only for color.

    My plan:

    • accept the CSS-wide keywords for every property (they are added where the property regexes are compiled, so the per-property definitions stay untouched),
    • keep invalid values invalid — only those four keywords are added,
    • update the one existing expectation that relied on an @font-face descriptor rejecting inherit,
    • add tests and a news fragment.

    I will open a PR with the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions