Archive - Tagged with 'html5'

< Back

Creating A Dynamic Css Color Palette For Both Light And Dark Modes

by Hexagon,

Today, I have an exciting CSS trick to share. When working on Lumocs, I wanted users to be able to set a color of their choice and have the page automatically adapt to that color. I had the idea of using CSS variables to achieve this. Lumocs supports both light and dark modes, so this had to be automatic as well. After some tinkering, I discovered a technique that enables you to generate a full color palette using any hue for both light and dark modes using only CSS.