Skip to content

[css-fonts] [palettes] Disallow usage of var() in @font-palette-values #6931

@drott

Description

@drott

In #6631 (comment) @andruud suggests that usage of var() inside @font-palette-values is unconventional compare to the usual usage of var().

We may want to disallow var() usage in @font-palette-values or - if that's not acceptable - specify it differently, so that it's evaluated in the element's context if really needed / possible.

@andruud's feedback:

However, allowing var() would introduce an awkward and unwanted dependency on the computed style of the root element, which we should probably avoid. It also seems a bit unfortunate from an author's standpoint to deviate from the computed-value-time/element-centric nature that var() currently has, and decide that it works in a different way here.

Going in the "author env()" direction seems more approachable, depending on its shape. There are other reasons we may need things like that as well, e.g. #6641.

Spec text after ee8dada:

Functions such as ''calc()'', ''var()'', and ''env()'' are valid within the braces of a
''@font-palette-values'' rule. They are evaluated within the context of the root
element. Relative units are also evaluated within the context of the root element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions