Hacker News new | ask | show | jobs
by vmarquet 3292 days ago
I'm surprised no one yet has mentionned the famous stack overflow question: https://stackoverflow.com/questions/8318911/why-does-html-th....

TLDR; For legacy reasons, some words produce valid colors even if they don't respect the standard color formats. For example, "chucknorris" produces red.

1 comments

Someone should make a list of all words and common phrases that result in a color different from #000000 and then go through them all and pick out the interesting ones.

By the way I didn't see any mention of max length. Is there a limitiation to the length of the color string?

Bonus question: What color would the complete works of Shakespeare be? Take all of his scene play manuscripts found on Project Gutenberg but excluding duplicates if any, sort them in the order they were originally published and concatenate into a single string.

The HTML5 color parsing algorithm is less complex than it seems. Mostly it boils down to "take any characters that aren't hex digits and replace them with zeroes, then truncate the resulting string in a consistent way to produce a 24-bit value".