Man, what a fascinating thread on the bizarre reasons that browsers will parse words into colours. To sum it up:
- Any word will be parsed into a hex code in order for things like
color: red
to work with backwards compatibility in CSS; - The way that conversion works is to change any non-hexadecimal letter into a 0, i.e. "chuck norris" becomes "C00C0 000000";
- But that leaves codes that are too long for the hex code format, so the next step is to shrink the string down to the maximum six characters;
- However, rather than just shortening to six characters, first the parser increases the number of characters until the total is divisible by three, then it splits the string into thirds, then concatenates each third into two characters and stitches it all back together again 🤯
- Why tho? 🤷♂️
- So you end up in a situation where "chuck norris" becomes a vivid red, whilst "chuck norr" is a slightly ill shade of yellow...
- And all of this matters because of hidden text in email spam (yeah, wow); if colours parse out differently, then spam is harder to identify, so the whole weird algorithm is an offical W3C standard. Brilliant 😂