Adapt a Light Palette for Dark Mode
Admin ·
A light color palette may need separate values for a dark canvas. Check the actual background and text pair before applying a generated theme.
Convert a light palette against a known dark background
Choose Blue brand. Keep Light background at #FFFFFF, set Dark background lightness to 10%, Saturation adjustment to 0 and Adaptation mode to Invert. The dark background rounds to #1A1A1A.
Set Color 3, primary, to #DDDDDD. At a minimum contrast of 1:1, the exact inversion is #222222. Raise the target to 4.5:1. The adjusted color is #828282, with a ratio of 4.53:1 against #1A1A1A.
| Color | Light output | Dark output at 1:1 |
|---|---|---|
| background | #FFFFFF | #1A1A1A |
| primary | #DDDDDD | #222222 |
CSS Color Module Level 4 HSL notationWCAG 2.2 contrast ratio definition
Apply the saved stylesheet and test a translucent foreground
Download the CSS variables. Reference var(--theme-background) for the page background and var(--theme-primary) for text. Set data-theme to dark on the page or on a container to switch the variables. The Tailwind v3 configuration maps the same names to those CSS properties.
Add a foreground with rgba(0, 0, 0, 0.12) and keep the 4.5:1 target. The foreground remains faint after brightening because its alpha is fixed. The tool reports the maximum ratio for that hue, saturation and alpha over the actual dark background.
CSS Custom Properties Level 1WCAG 2.2 contrast ratio definitionTailwind CSS v3 custom colors
Common questions
Does the target change my surface colors?
The target applies to rows marked Foreground. Surface rows follow the adaptation mode's surface range.
Can I enter a contrast target of 7:1?
Yes. The tool reports the resulting ratio and whether it reaches that target for the generated color pair.