Skip to content

hex color codes

Do people not understand hex color codes? I see a meme running around in which people put their username into a <font color=”n“> tag… the thing is, unless your username is 1) exactly 6 digits long, and 2) consists only of numeric digits and/or the letters a-f, you will get strange results as the browser tries to sift through the invalid input and do something meaningful with it. Most often, it just gives up and displays black.

Maybe hex codes are a little estoric… but here are some simple pointers:

  • A reasonable way to attempt to resolve invalid hex input (as most usernames are) would be to first discard all input values which can’t contain valid information. Thus, if your username was alex, the computer would strip out everything except ae. If your username was h4x0r, you would end up with 40.
  • A hex color value expects six digits: the first 2 quantify the value of the color red, the second 2 quantify the value of the color green, the third 2 quantify the value of the color blue. If you have less than six digits, the browser will probably fill the rest with 0′s. If you have more, it will probably discard the digits after the sixth. A consequence of this is that most usernames will result in reddish colors, or maybe shades of orange to yellow. Few people will actually have six valid digits in their name.
  • #000000 is black. #FFFFFF is white. #FF0000 is red. #00FF00 is green. #0000FF is blue. You can combine the colors, or change their intensity, by changing the values. Multiplying each part of a hex value by some constant value will darken or lighten the color. Multiplying the whole hex value will also do that, but will not preserve the portions; the color will change.

It’s not that it damages the browser, or is particularly bad for any other reason… it’s just that it speaks of ignorance about what’s going on. And it makes the standards-aware part of me just cringe.

RSS feed | Trackback URI

Comments »

No comments yet.

Name
E-mail
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Trackback responses to this post