View Single Post
Old 03-18-2004, 02:39 AM   PM User | #12
shlagish
Senior Coder

 
Join Date: Apr 2003
Location: Canada
Posts: 1,063
Thanks: 2
Thanked 0 Times in 0 Posts
shlagish is an unknown quantity at this point
Q: How can I specify colour?

A:
There are three ways.
  1. Using the name of the colour
  2. Using an rgb value such as rgb(255,255,255)
  3. Using a hexadecimal value such as #FFFFFF

Using the name of the colour
Just enter a colour name that is accepted. A list of accepted colours can be found... well, here:
  • aqua
  • black
  • blue
  • fuchsia
  • gray
  • green
  • lime
  • maroon
  • navy
  • olive
  • purple
  • red
  • silver
  • teal
  • white (white, but you can't see it because of the background)
  • yellow

Using an rgb value
With this method, you specify the amount of red, green and blue respectivly there is in the colour for a maximum of 255.
so this: rgb(255,0,0) is red.
rgb(0,255,0) is green
rgb(0,0,255) is blue.
rgb(0,0,0) is black (no colour)
and rgb(255,255,255) is white (all colours)


Using a hexadecimal value
This is pretty much the same as rgb, except you give the values in hexadecimal.
The first two numbers are for red, the last two are for blue and the middle two are for green.
#redredgreengreenblueblue
so this: #FF0000 is red.
#00FF00 is green
#0000FF is blue.
#000000 is black (no colour)
and #FFFFFF is white (all colours)

But you can also shorten the hex value if all the colors are represented by a pair of numbers.
ex:
#FFFFFF, #000000, 5544FF, 996633, etc.
Just replace the pair with a single number
#FFF, #000, #54F, #963

One more thing. In CSS, we use color (background-color).
but don't be confused, the proper english is indeed colour (with the u).
So if you want your text colour to be red, you can put:
body { color: red; } or
body { color: rgb(255,0,0); } or
body { color: #FF0000; } or even
body { color: #F00; }
__________________
Shawn

Last edited by liorean; 01-07-2005 at 03:58 PM.. Reason: Making red really red
shlagish is offline