Summary
In CSS terms, color capability is advancing rapidly. We have looked at the basics of setting colors and alpha layers in CSS using hex and functional notation. We have also considered how to make use of wider gamuts such as P3 and how to provide fallbacks in a couple of ways for older devices.
Later, we looked at the cutting-edge features of color which are just gaining browser support. We have looked at mixing colors with color-mix()
, creating a color relative to another with the relative color syntax, and, perhaps most usefully, how we can ensure contrasting colors, and gaining better accessibility with the use of the color-contrast()
function.
As this is such a dense topic, below is a list of resources to read further on the topic. But that doesn’t mean we won’t look at color more. On the contrary, we will need it in the next chapter, Chapter 8, Stunning Aesthetics with CSS, where we will be looking at gradients, shapes, and so much more.