Dark Mode Filter Generator
Generate a CSS filter that turns a light interface dark without rewriting any of its styles. Give it a target background colour and it solves the filter chain for you, or tune the individual filter functions by hand and watch the preview update.
The filter it produces is closely related to the CSS Filter Generator and the Glassmorphism CSS Generator. Contrast in the inverted state still needs the Color Contrast Checker, since inverting both sides of a pair does not preserve the ratio.
How to use the Dark Mode Filter
- 1 Choose a mode. One applies a filter to darken a light interface; the other solves the chain that turns a target colour into the colour you want.
- 2 For the inversion mode, set the filter and see the preview update across the sample interface.
- 3 Adjust the hue rotation so that colours return to roughly their original hue after inversion — this is the step people usually miss.
- 4 Copy the generated rule, and remember to exclude images and video from it.
When a filter is the right answer
The filter approach earns its place when you cannot change the stylesheet. Common cases are embedding an older internal tool in a modern shell, applying a dark reading mode to content you do not own, and quickly demonstrating what a dark version would look like before committing to building one properly.
For an interface you do control, the same visual result is achievable with CSS variables and a media query, at no runtime cost and with full control over every value. A filter forces the browser to composite the entire subtree, which is measurable on a large page.
- Invert plus a 180-degree hue rotation is the standard chain.
- Re-apply the same filter to images so they invert twice and return to normal.
- Exclude anything that is already dark, or it will invert to light.
- Check contrast afterwards — an inverted interface often fails AA somewhere new.
The image problem
A blanket invert filter also inverts your photographs, turning them into negatives. The usual fix is to apply the same filter a second time to images, which cancels the inversion while leaving the surrounding interface dark. The generated CSS includes that rule.
Frequently asked questions
Why does a plain `invert(1)` produce such odd colours?
Because inverting a colour is not the same as swapping its lightness. Inversion also maps each hue to its opposite, so a blue interface becomes orange, a red button becomes cyan, and skin tones turn a sickly blue. The standard correction is to invert and then apply a 180-degree hue rotation, which returns hues close to where they started while keeping the lightness inverted.
Why must images and video be excluded?
Because they are already the colours they should be. Applying the filter to a photograph inverts it, and the hue rotation brings the hues partway back but leaves everything looking like a colour negative. The usual approach is to re-invert images inside the filtered container, applying the same filter a second time so they cancel out.
Is a filter-based dark mode as good as a real one?
No, and it is worth being clear about the trade-off. A proper dark theme adjusts each surface, text colour and border deliberately, so contrast is controlled and brand colours shift in a considered way. A filter is a retrofit that works acceptably on an interface you do not control, such as a third-party embed or a legacy tool — not a substitute for designing a real dark theme when you can.
Related Image & Color Tools
You might also need
Tools from other categories that people pair with the Dark Mode Filter: