0% found this document useful (0 votes)
2 views

Colors

The document discusses web colors, highlighting that CSS supports 140 named colors and can create over 4 billion colors using hexadecimal RGB format. It explains the hexadecimal number system and how colors can also be specified using decimal RGB, CMYK, and HSL values. Additionally, it covers the use of transparency in CSS with the alpha value.

Uploaded by

Melissa Lemus
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Colors

The document discusses web colors, highlighting that CSS supports 140 named colors and can create over 4 billion colors using hexadecimal RGB format. It explains the hexadecimal number system and how colors can also be specified using decimal RGB, CMYK, and HSL values. Additionally, it covers the use of transparency in CSS with the alpha value.

Uploaded by

Melissa Lemus
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Colors

on the Web
Web colors

Think about ‘red’.

How many variations of red do you know?

2
Web colors

Here are some example shades of red:

CSS supports 140 ‘named’ colors:


https://www.w3schools.com/colors/colors_names.asp
These are also known as ‘web colors’

It is however possible to create


4,294,967,296 colors using CSS!

3
Hex colors

Colors are usually can be written in the hexadecimal RGB format:

Do you know which colors these values represent?

#FF0000
#00FF00
#0000FF

4
Hex colors

Colors are usually written in the hexadecimal RGB format to store


colors efficiently as 32-bit values:

Indicates a
hexadecimal value # 00 00 00
Red value Green value Blue value
00 to FF 00 to FF 00 to FF

5
Hexadecimal number system

The decimal system counts from 0 to 9, with 10 possible numbers

The hexadecimal system counts from 0 to F, representing a value of


15, with 16 possible numbers.

Because we don’t have individual numbers for 10, 11, 12, 13, 14 and
15 these are written as A, B, C, D, E and F

For example: FF in hexadecimal = 16*16 = 256 in decimal. This


gives us 256*256*256 possible color combinations.
6
However…

CSS also allows us to specify colors as decimal RGB values


h1 {
color: rgb(255, 0, 255);
}

And even as CMYK (Cyan, Magenta, Yellow, BlacK) and HSL (Hue,
Saturation, Lightness) values:
h1 {
color: cmyk(100%, 0%, 0%, 0%);
background-color: hsl(0, 100%, 50%)
}
7
Transparency

Finally, it is possible to use transparency in css, using the alpha


value.
background-color:rgba(255, 99, 71, 0.2);

Alpha is a number between 0.0 (fully transparent) and 1.0 (fully


opaque)

You might also like