8000 [css-values][css-color] Generic hexadecimal number notation · Issue #2024 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-values][css-color] Generic hexadecimal number notation #2024

@Crissov

Description

@Crissov

Inside the color() function and perhaps elsewhere, some authors may prefer to enter numeric values in hexadecimal notation, especially for 8-bit integer values. Currently, CSS only supports hexadecimal numbers as (shortened) tuples in <color> (#F00) and for Unicode code points (\0F00). Notation variants popular in other languages, e.g. 0xF00 or hF00, will not work well in CSS Syntax. Unitless integers cannot generally be used inside color() because floats between 0 and 1 are frequently used there (although CSS's classic native notation is percentages for those #2021).

If authors regularly feel the need to enter hexadecimal numbers indeed, CSS should support an alternative integer notation inspired by RGB triplets. To avoid confusion with the three-digit shorthand #F00, however, it probably makes sense to restrict these numbers to one or two digits: #0..#F and #00..#FF, i.e. value ranging from 0 through 255. It would be needed to decide whether #F equaled #0F or #FF.

I'm not convinced myself this syntactic sugar is actually needed, but its merits and costs should be evaluated anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0