Why does HTML think “chucknorris” is a color?

Why does HTML think “chucknorris” is a color?

4 years ago
Anonymous $rxtAWepgzY

Coloring in HTML basically takes two types of values, RGB(R, G, B - each from 0 to 255) or HEX#(RR, GG, BB each from 0 to F in hexadecimal) which can be represented interchangeably. If you are putting any word at bgcolor that contains a few hexadecimal character then that character will show you some unexpected color that you never imagine.The logical explanation behind this - during Netscape days, incorrect digits in a color code were considered as 0.

So if you apply the same rule to chucknorris

Replace all non-hex characters with 0 - you get c00c0000000
Pad out the characters so the total numbers are divisible by 3 - c00c 0000 0000
Split into 3 groups for RGB - c00c, 0000, 0000
Truncate the digits from the right to 2 characters in each color group - c0, 00, 00 (RGB).
This gives you the hex color #C00000 which is a shade of red.

http://net-informations.com/q/web/color-codes.html