Why does HTML think “chucknorris” is a color?

User avatar
Leif
Administrator
Posts: 6840
Joined: 16 Jan 2010, 08:21
Location: UK

Why does HTML think “chucknorris” is a color?

Post by Leif »

Just in case someone does have this this issue, a totally unrelated search regarding HTML threw up this little nugget:

Why does HTML think “chucknorris” is a color? - Stack Overflow

Which brought me to random string to css color in case you want to know what colo(u)r you represent.

Too good not to share, I thought :grin:
Leif.

User avatar
HansV
Administrator
Posts: 69449
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Why does HTML think “chucknorris” is a color?

Post by HansV »

Learn something new every day...

Thanks! :smile:
Regards,
Hans

User avatar
Rudi
gamma jay
Posts: 25167
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Why does HTML think “chucknorris” is a color?

Post by Rudi »

It seems I'm green with envy, whereas Claude comes closest to a glass of wine, (quite fittingly)!
I won't say much about the colour for Leif! :crazy:
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
Leif
Administrator
Posts: 6840
Joined: 16 Jan 2010, 08:21
Location: UK

Re: Why does HTML think “chucknorris” is a color?

Post by Leif »

Moi? Brown?

More like Leif :smile:

:whisper: You can use the they give you:
x.jpg
You do not have the required permissions to view the files attached to this post.
Leif.

User avatar
Rudi
gamma jay
Posts: 25167
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Why does HTML think “chucknorris” is a color?

Post by Rudi »

It looks too "black" in the font... I thought I was kind to give you a bit of colour.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
Leif
Administrator
Posts: 6840
Joined: 16 Jan 2010, 08:21
Location: UK

Re: Why does HTML think “chucknorris” is a color?

Post by Leif »

I think I'd get plenty of colour if I drank any wine the colour of Claude above... :laugh:
Leif.

User avatar
Rudi
gamma jay
Posts: 25167
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Why does HTML think “chucknorris” is a color?

Post by Rudi »

Leif wrote:I think I'd get plenty of colour if I drank any wine the colour of Claude above... :laugh:
:laugh: :sick:
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
stuck
UraniumLounger
Posts: 6270
Joined: 25 Jan 2010, 09:09
Location: up North (but it's not that grim)

Re: Why does HTML think “chucknorris” is a color?

Post by stuck »

stuck comes out as a shade of grey (#000c00). That might explain my gripes here

Ken

malcomjarr
NewLounger
Posts: 1
Joined: 16 Nov 2020, 05:49

Re: Why does HTML think “chucknorris” is a color?

Post by malcomjarr »

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 code 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.

User avatar
HansV
Administrator
Posts: 69449
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Why does HTML think “chucknorris” is a color?

Post by HansV »

Welcome to Eileen's Lounge! Thanks for the explanation (which corresponds to that in the StackOverflow link in the first post)
Regards,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 11517
Joined: 24 Jan 2010, 23:23
Location: paused.undefined.exposed

Re: Why does HTML think “chucknorris” is a color?

Post by ChrisGreaves »

Leif wrote:
26 Jan 2017, 09:29
Which brought me to random string to css color in case you want to know what colo(u)r you represent.
That kind of stunt makes me see red.
Cheers
Chris
We hate change, but love variety.