Type your brand colour and we build two matching palettes for light and dark mode: backgrounds, text, borders and the brand colour tuned for each mode, with a WCAG contrast check for every colour and CSS that follows the visitor’s device setting.
A dark background tinted with your brand colour, not pure black
Lightening the primary so it stays readable
Lower saturation for long text
Avoid
Pure #000 with pure white
The same button colour in both modes
Automatic colour inversion
How does the code work?
The code defines colours as CSS variables and swaps them when the visitor’s device is in dark mode (prefers-color-scheme), and it respects a toggle you add by setting data-theme on the html element. Test colours on your type with the contrast checker, and get more shades with the colour converter.
Example: dark mode for a store
Enter the store colour, paste the code into Additional CSS, then replace fixed colours in your styles with variables like var(--bg) and var(--text). Open the store on a phone in dark mode and check prices and buttons are clear.
Key terms
Short definitions of what you meet along the way.
prefers-color-scheme
A CSS query that tells whether the visitor’s device is in dark mode.
Contrast ratio
How legible text is on its background; normal text needs at least 4.5:1.
CSS variables
Variables that hold colours and switch from one place.
We use necessary cookies to run the site, and Google Analytics to measure visits only if you agree. You can change your choice at any time from “Cookie settings”. Privacy policy