Generating shades of color using CSS variables

Jim Nielsen / filed under HTML & CSS

Quite often I’ve found myself using CSS custom properties (a.k.a. CSS variables) for working with color values (especially when doing dark themes). This is usually the type of CSS I’ve written:

Subscribe to newsletter

Design and frontend links delivered to your inbox every day and week. No spam, unsubscribe at anytime.

Choose frequency

Permission