HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 7. COLORS 74


words overlaid onto it. You can have one picture overlaid on top of another.
Maybe we can see through parts of that picture to the picture that is below.


In the RGB model there is also a component fortransparencyoropacity,
called thealphachannel.


Exam Question 116(p.343): In rgba, what does the a stand for?
Required Answer:alpha


Exam Question 117(p.343): What does the alpha channel control?
Acceptable Answer:opacity


A value of 1 or 100% means totally opaque.


A value of 0 means totally transparent.


A background color of rgba(255,255,255,0.7) would be 70% opaque white.
That is, you would be able to see through it like looking through a thin film
of white paper.


A background color of rgba(0,0,0,0.5) would be 50% opaque black. That is,
you would be able to see through it like looking through a thin film of black
paper.


Contrast:Such rgba background colors can be very useful when the content
you are showing is on top of a background image that is very busy. If the
background image swallows up your content, you might want to put a layer
of partly transparent white or black between the content and the ultimate
background.


7.4 The Web Color Wheel


Because RGB is the most natural and commonly used way of specifying
colors on the web, let us try to develop some intuition about how these
numbers relate to the colors we might want.

Free download pdf