2.8 Hexadecimal Color



We use hexadecimal codes to specify colors, like this:


#ff0000 /* the brightest red */
#660000 /* dark red */
#00ff00 /* the brightest green */
#0000ff /* the brightest blue */
#000000 /* no color, or black */
#ffffff /* all color, or white */
#ffff00 /* a secondary color, yellow */

The value consists of 6 numbers or letters, preceded by a #. The case of the letters does not matter. The first two placeholders are for red, the second two are for green, and the last two are for blue. Hexadecimal is a base-16 system, so you can only use the following numbers and letters:

0 1 2 3 4 5 6 7 8 9 A B C D E F

Closer to 0 is less color, while closer to F is more color.


It’s possible to specify a color with some opacity in CSS. The easy way:


Or the newer method, using the alpha channel in RGB as seen below. When you specify colors in RGB the values range from 0 (no color) to 255 (full color). Use a color picker to find the values.


In both of these, the opacity value ranges between 0 (completely transparent) and 1 (completely solid).

Color Pickers

Most graphics applications will have a color picker you can use, or you can try Google's color picker (seen here).

google's color picker

Two others to try that offer more functionality such as creating and saving color palettes are Adobe Color and Coolors