W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2017

[csswg-drafts] [css-values][css-color] Generic hexadecimal number notation

From: Christoph Päper via GitHub <sysbot+gh@w3.org>
Date: Fri, 01 Dec 2017 12:55:13 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-278458064-1512132913-sysbot+gh@w3.org>
Crissov has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values][css-color] Generic hexadecimal number notation ==
- [CSS Color: Hex Notation](https://drafts.csswg.org/css-color/#hex-notation)
- [CSS Values: Integers](https://drafts.csswg.org/css-values/#integers)
- [CSS Syntax: Hash Token](https://drafts.csswg.org/css-syntax/#typedef-hash-token)

Inside the [`color()` function](https://drafts.csswg.org/css-color/#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.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2024 using your GitHub account
Received on Friday, 1 December 2017 12:55:20 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:26:44 UTC