Skip to content

CSSColorValue.colorSpace restricts naming of future color functions and color() keywords #1070

Closed
@tabatkins

Description

@tabatkins

CSSColorValue exposes a .colorSpace attribute and a .to(colorSpace) method, which use the same set of strings. For color() functions, the corresponding string is the color space keyword; for the other color functions, the corresponding string is the function name.

These two sets of names aren't guaranteed to be distinct! Currently, there's no overlap, but there was in a previous revision to the spec when color(lab ...) was allowed.

@svgeesus and @LeaVerou, do you think restricting these two sets to be non-overlapping in the future is reasonable? Or do you think it's plausible we may want to have such an overlap? If the latter, I think the easiest solution for this is to use parens at the end of the string for the function names, so CSSRGB.colorSpace would return "rgb()", you'd call c.to("rgb()"), etc. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions