Relative Colors

Chris Coyier Chris Coyier on

I love the idea of being able to take a color you already have in CSS, like currentColor, a custom property, or a color pulled from an attr(), and manipulate it. The big examples being darken, lighten, or apply opacity to it for different adjacent elements or states.

We have a ton of “newly available” power in CSS with this in the form of the relative color syntax, and Ahmad’s new post about this is great. The color-mix() function has a bit better browser support and has a good amount of overlap in what it can do, but I prefer the syntax and power of the relative color syntax.

Wanna be a better designer?

Frontend Masters logo

Sarah Drasner is a heck of a designer, and has a wonderful course called Design for Developers where you'll learn to be a self-sufficient designer.

7-Day Free Trial

Leave a Reply

Your email address will not be published. Required fields are marked *

Did you know?

Frontend Masters Donates to open source projects. $363,806 contributed to date.