|
HTML Tutorial: Colors |
|
Do you remember those 16 official named colors?
| aqua | black | blue | fuchsia | gray | green | lime | maroon |
| navy | olive | purple | red | silver | teal | white | yellow |
It's hard to remember a list of anything that's 16 long. Also, if you memorize the list you'll be about 17 million short of the full variety you can choose. The bad news is that you'll need to understand hexadecimal numbers. My daughter stumbled on this one at first. So this is a slower-paced rewrite of the original tutorial.
For this discussion, please read "10" as "one, zero." If we are using Arabic numerals in the customary ten-based system, "10" ("one, zero") stands for the number ten. (From here on, I'll use the English name as a stand-in for the number itself.) "10" ("one, zero") is a symbol. It stands for ten, sometimes.
OK, computer dude. But what symbols shall we use for ten through fifteen?
Perhaps unimaginative, but simple to remember, base sixteen (also known as "hexadecimal" numbering, or just "hex") uses the first six letters of the English alphabet. Here are the first numbers, starting from zero by English name, decimal symbol and hex symbol:
| Number | zero | one | two | three | four | five | six | seven |
| Decimal symbol | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| Hex Symbol | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| Number | eight | nine | ten | eleven | twelve | thirteen | fourteen | fifteen |
| Decimal symbol | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| Hex Symbol | 8 | 9 | a | b | c | d | e | f |
| Number | sixteen | seventeen | eighteen | nineteen | twenty | twenty-one | twenty-two | twenty-three |
| Decimal symbol | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| Hex Symbol | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
Get the pattern? In decimal, you use ten symbols. When you get to ten, you start recycling those same symbols "10", "11", and so on. In hex you use sixteen symbols and start recycling at sixteen "10", "11", and so on.
bgcolor attribute, this way:
<... bgcolor=#rrggbb>
Only you don't use those letters, you use hex digits. Do you want pure red? Set maximum red and no green or blue: ...bgcolor='#ff0000'>. (Lots of things support the bgcolor= attribute. You've used it to set the body background color to that lame silver.)
#000000 |
#ff0000 |
#00ff00 |
#0000ff |
#ffff00 |
#ff00ff |
#00ffff |
#ffffff |
Little kids love bright, primary colors like these. Doing a nursery? This is your palette.
f8) and not quite so high blue (f0), then changing them a bit at a time I got to one I liked: #fcf8f0. The background for these tables is a simple light blue: #f0f0ff (maximum blue, a bit less for red and green).
Here's a table where the page color morphs to the table color.
#fcf8f0 |
#f9f6f4 |
#f6f4f8 |
#f3f2fc |
#f0f0ff |
Study the colors one at a time. Red is dropping 3 at a time. Green is dropping two at a time. Blue is rising 4 at a time.
Do you see how I'm thinking? Hex f0f0ff is decimal 15,790,335 (or at least that's what my calculator tells me). I neither know nor care. Hex f0 is something in decimal, but to me its just some number near to, but less than maximum ff.
<body bgcolor='#f0f0f0'>
Then change those, one color at a time, and only a little at a time. Fiddle with it until you get a color you really like. When you're happy, change the other pages to use your happy color.
I like that color half way between this page and the table color. Here's my revised index.html.
bgcolor='#ffffff' you'll be overriding my choice, which is rude. (Of course, if you have a specific requirement for white, as opposed to just a light background, then go for white. The French flag is blue, white and red—not blue, soft background and red.)
If you think playing with these effects is fun, you're right. If you want to do it yourself with tables, that comes next.
| Tables! Colorful tables! |