Why does 'Chuck Norris color' look red in HTML?



When specifying a color in HTML or CSS, in addition to a 'color code' consisting of six hexadecimal digits, there is a way to directly specify the color name. However, even if you specify 'Chuck Norris', which is supposed to be just the name of an actor, instead of the color name, for some reason a reddish color will be displayed without any problems. There is a good reason for this mechanism.

Sam's place: A little rant about Microsoft Internet Explorer's color parsing

https://scrappy-do.blogspot.com/2004/08/little-rant-about-microsoft-internet.html

browser - Why does HTML think “chucknorris” is a color? - Stack Overflow
https://stackoverflow.com/questions/8318911/why-does-html-think-chucknorris-is-a-color

When specifying colors in HTML or CSS, a six-digit hexadecimal number ranging from '#000000 (black)' to '#ffffff (white)' is used. Each of these numbers indicates an RGB value, with the first two digits representing the color. For example, 'red' has an RGB value of (255,0,0), so the color code is written as '#ff0000,' and 'green' has an RGB value of (0,255,0), so the color code is written as '#00FF00.'



However, although color codes allow you to specify colors in fine increments, they can be tedious, so names and color codes have been defined for 140 representative colors, such as 'gray (#808080),' 'sky blue (#87ceeb),' 'chocolate (#d2691e),' and 'beige (#f5f5dc),' so you can also specify colors by name.

The mystery that arises is that even if you specify the color 'chucknorris,' which is not included in the color name definition, a reddish color appears, rather than black or white.



Actor Chuck Norris is a martial artist who played the karate master who stands in the way of Bruce Lee in the film 'Way of the Dragon.' With a track record of appearing in numerous action films, he also appeared in the all-star film 'The Expendables 2.'

'The Expendables 2' Trailer-YouTube


Considering his career, one might imagine that the color is reddish because it brings to mind the idea that 'wherever Chuck Norris goes, it rains the blood of his enemies.' However, the reason it is actually this color is because 'there is a mechanism that converts even strings of characters that are unrelated to color into color codes.'

The rules for converting strings to color codes are as follows:

1: Insufficient digits or invalid digits are treated as '0'
As mentioned above, color codes are expressed as 6-digit hexadecimal numbers, but any missing or invalid digits are treated as '0'. For example, '#F0F0F', 'F0F0F', '#FxFxFx', and 'FxFxF' are all treated the same as '#F0F0F0'. In the case of 'Chuck Norris colors', only the 'c' in the notation is valid, so 'chucknorris' becomes the hexadecimal value ' c00c0000000 '.

2: Make the total number of numbers divisible by 3
Since the number converted from Chuck Norris' color in step 1 is 11 digits, zeros are added to the end to make it ' c00c00000000 .'

3: Divide the numbers into 3 equal groups
If the Chuck Norris color is 'c00c00000000' which was converted in step 2, it can be separated as 'c00c 0000 0000'.

4: Keep the first two digits and make it into a color code
In the case of 'c00c 0000 0000', if you leave the first two digits it becomes 'c0 00 00'. This makes a total of six digits, so by joining them together we get the color code '#c00000', which is a number that represents RGB(192,0,0).

For example, if you cut Chuck Norris into nine letters to make it 'chucknorr,' after completing step 3 you will get 'c00 c00 000,' and after performing step 4 you will get the light yellow color ' #c0c000 .'



If we apply the same conversion to the 'GIGAZINE color,' we end up with a dark green color, '

#00a00e .'



in Note, Posted by logc_nt