April 11, 2003

Hacking (as in repeatedly hitting something with a blunt instrument)

In this case, my brain. :-)

Fi and I spent lots of last night (and a couple of phone calls to Kim and Reb) trying to mess with the stylesheet for her blog, with eventual success.

Lesson: the main index page defines the layout; the style-sheet defines the colours and stuff. Duh. (I am remarkably clueless. You'd be amazed.)

I still don't understand why some of the colours in the stylesheet are defined with 6 characters (eg, #FFFFFF) and others are defined with 3 (eg, #CCC). What's up with that?

Posted by iona at April 11, 2003 09:37 AM
Comments

I think the ones with 3 characters are all fonts???

Posted by: fionnaigh at April 12, 2003 09:52 PM

Reb said she thought they might be shorthand, eg, FFF is shorthand for FFFFFF, and maybe CFF is shorthand for CCFFFF. Not sure though.

Posted by: iona at April 13, 2003 03:30 PM

Then why are only some of them three characters? Why not make them all shorthand (Since they are all double characters, like ff99cc or whatever)?

Posted by: Fee at April 14, 2003 11:24 AM

Ok - here's how it works (getting geeky onnit):

The letters are hexadecimal numbers from 11 - 15, complimenting the usual 0-9.

They are separated into 3 lots of 0 to 255 (16*16 minus 1 because of 0), representing Red, Green and Blue.

So #FFFFFF = #255 255 255 = very red, very green, very blue = white (colour theory in action).

But! Not all machines show colours the same. However, there are a bunch of colours called 'websafe' colours that should always work, and by a curious coincidence they match the following values in hex - 00 33 66 99 CC FF (or 51, 102, 153, 204 and 255 in decimal). So if your css has #fc9 as a shorthand for #ffcc99 you know it will be websafe.

But! (again)! you can use #1de, or non-websafe numerals in those three - so what does three hex numerals give you then? Well, the number of colours you can express with three numerals is 16 to the power of 3, or 4096 colours. If you use all 6 numerals you can create 16 to the power of 6 or 16777216 colours. Not all monitors handle 16 million colours though, either through design or user setting, so some folks use the three numeral 'double' shorthand to ensure they stay within certain colour limits and ensure their designs don't go all glucky on less capable monitors.

Here endeth the lesson.

Posted by: Giles at April 14, 2003 03:26 PM