Why hex is still the default
It is one token. It survives being pasted into a spreadsheet, a Figma field, a
YAML file and a chat message without anyone worrying about commas or spaces.
rgb(255, 87, 51) does none of that reliably.
Channels out of range
rgb(300, -20, 51) is not a colour, but it is a thing people paste. Values are
clamped to 0–255 rather than wrapped, so 300 becomes 255 and −20 becomes 0 —
which is what a browser does with the same input.
Uppercase or lowercase
Purely cosmetic; both are valid CSS. This prints uppercase because it reads
slightly better against lowercase property names, and because the difference
between #FF5733 and #ff5733 in a diff is noise you can avoid by being
consistent either way.
Questions
Uppercase or lowercase hex?+
Both are valid CSS and identical to a browser. Pick one and be consistent, so diffs stay readable.
What happens to values over 255?+
They are clamped, not wrapped: 300 becomes 255. This matches how a browser treats the same input.
Why is hex still preferred?+
Because it is a single token that survives being pasted anywhere — a spreadsheet cell, a Figma field, a YAML file — without anyone worrying about commas.