Sven Rautenberg: Hex-Farbangaben abkürzen

Beitrag lesen

Moin!

Es ist regelkonform im CSS-Standard definiert, die Browser machen es reproduzierbar immer gleich.

Schön und gut, aber was bringt es ? Warum hat man sich das ausgedacht ?

Es spart drei Bytes ein. In Zeiten, in denen man selbst im Handy schon Megabytes hat, wirklich ein enormer Gewinn.

Die dreistellige Farbangabe ist unabhängig von der Farbtiefe des Displays - sagt jedenfalls das W3C:
"The format of an RGB value in hexadecimal notation is a '#' immediately followed by either three or six hexadecimal characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display."
http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-color

- Sven Rautenberg

--
Diese Signatur gilt nur am Freitag.