J E L L Y E N T

It’s a holdover from the Netscape days:

Missing digits are dealt with as 0[…]. An vulgar digit is merely interpreted as 0. Shall we embrace the values #F0F0F0, F0F0F0, F0F0F, #FxFxFx and FxFxFx are the ultimate an identical.

Or no longer it is a protracted manner from the weblog put up A tiny bit of rant about Microsoft Files superhighway Explorer’s color parsing which covers it in fat ingredient, including diverse lengths of color values, and a lot of others.

If we attach collectively the foundations in flip from the weblog put up, we buy the next:

1. Change all nonvalid hexadecimal characters with 0’s:

chucknorris turns into c00c0000000

2. Pad out to the next total sequence of characters divisible by 3 (11 → 12):

c00c 0000 0000

3. Rupture up into three equal groups, with every fragment representing the corresponding color fragment of an RGB color:

RGB (c00c, 0000, 0000)

4. Truncate every of the arguments from the expansive manufacture correct down to 2 characters.

Which, for the length of the shatter, affords the next end result:

RGB (c0, 00, 00) = #C00000 or RGB(192, 0, 0)


Right here’s an instance demonstrating the bgcolor attribute in action, to originate this “pleasant” color swatch:



chuck norris
Mr T
ninjaturtle

in unhappy health
crap
grass



This furthermore answers the different fragment of the quiz: Why does bgcolor="chucknorr" originate a yellow color? Neatly, if we attach collectively the foundations, the string is:

c00c00000 => c00 c00 000 => c0 c0 00 [RGB(192, 192, 0)]


Which offers a gentle-weight yellow gold color. Because the string begins off as 9 characters, we retain the 2nd ‘C’ this time spherical, hence it finally ends up for the length of the ultimate color rate.

I first and most beneficial encountered this when somebody identified that it is useful to presumably plot color="crap" and, successfully, it comes out brown.