I'm aware that the method to convert a 3 digit hex css color to 6 digit code is by duplicating each hex digit once, as below.
#ABC === #AABBCC
Why does it work this way? Why isn't #ABC
equivalent to #A0B0C0
?
From the W3C spec:
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.
You can read more about it here: http://www.w3.org/TR/css3-color/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With