-
Notifications
You must be signed in to change notification settings - Fork 757
Description
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.