More on Colours...
Because using colour is important, you should do your best to follow this section. If you find it tough going, then you could maybe skim through it now then come back to it again a little later.
Using the named colours limits you to 16 different ones. Some people still use machines that will only show 16 colours. This might be because their machine is not capable of displaying more colours, or because they perhaps don't want to change the display or, indeed, perhaps they don't know that they can change the display. In any event, while the majority of users will view in 256 colours or more, bear in mind that, for those who don't, your pages may not appear as you intend them to.
Another complication arises because different machines will treat the colour codes - which we will come onto in a minute - in different ways, and something that displays well, say under Windows on your PC, may look perfectly hideous on a Mac, and vice versa. This is known as dithering and means that your system is trying to approximate a colour as best it can - sometimes it gets close, but results are unpredictable at best.
All is not lost, though. It is generally reckoned that there are 216 colours which are considered to be a 'safe' palette in that they're OK on the majority of machines...fingers crossed...;-)
Now for the hard bit, hold tight...
If you're familiar with hexadecimal numbers you'll know hexadecimal digits go from 0 to 9 and then from A to F. Without going into too much detail then, 4F, CC5, D0B8 are valid hex numbers but 7G and H99 are not.
Why do you need to know this? Well, it's because the colours that your browser displays are more typically given a code rather than a name - at least, they are if you want to use more than the 16 that you've already met. The code is a six digit hexadecimal number. Unfortunately there are many thousands of these.
So how will you know which codes to use? Here are three possible solutions
1. If you're using a good web page authoring package, it should have a palette such that you just choose the colour and the software puts in the code for you. The format for this to set, say, the page and text colours is:<BODY BGCOLOR="#FF3300" TEXT="#CCFFCC">
...which should produce red text on a pale green background. Note that you should use quotes and the '#' sign.
2. Visit http://www.lynda.com/hex.html which has the 216 'safe' colours and their codes for you to look at.
3. The six-digit hex code is actually made up as follows: the first two digits give the value of the red component, the next two give the green component, and the last two the blue component. The exact 'mix' of these will determine the colour that you see. This is called the RGB value. A two-digit hex number can have a value from 00 (ie zero) up to FF (which is 255 in decimal).
A good graphics package will let you see the RGB value for any colour in its palette. This may be a decimal value, however, so you'd need to convert it to hexadecimal to use it. If you want to stick with the 'safe' colours then these are made up from any combination of hex 'pairs' chosen from the digits 0, 3, 6, 9, C and F.
So, for example, CC9933 and FF6600 are OK but 99AA33 is not.
Phew! Heavy stuff, huh? We'll have a look at how to do textured backgrounds and other types of background later on in the course.
|© 1999 ePublish Scotland