How is the bgcolor property being calculated? [duplicate]

My first try on this was a little trial on error and while I found some interesting properties of the system, it wasn’t quite enough to form an answer. Next, I turned my attention to the standard. The reason that I believed this to be in the standard was that I tested it on three different browsers and they actually all did the same thing. Using the standard I found out what happens:

  1. All characters that aren’t hexadecimal are replaced by zeroes (so only zeroes, 1-9 and a-e remain)
  2. The string is zero padded at the end to be a multiple of three
  3. The string is then divided up in three equal parts, each representing a color
  4. If the resulting strings are longer than 8 characters, take the last 8 characters of each string
  5. As long as each of the strings starts with a zero, the first character is removed from each string (not happening for this particular string since it starts with De
  6. The first two characters are taken from each of those strings and converted to a number for use as one of the components of the color

This way you’ll see you get 00FA00 for Deine Mutter hat eine Farbe und die ist grĂ¼n.

The html5 standard describes the process more precisely and actually describes a couple more cases here: http://www.w3.org/TR/html5/common-microsyntaxes.html#colors under the “rules for parsing a legacy color value”

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)