CSS Custom Property Theme Builder with Dark Mode Overrides

Writes a CSS custom property theme with light and dark values, using the media query, a data attribute, or both.

Use the tool

Why this tool exists

Theming with custom properties is simple until dark mode: you need the same names defined twice, and users want both the system setting and a manual switch.

Write one line per token, with the light value then a bar and the dark value. The tool outputs :root, the prefers-color-scheme block and an optional attribute selector. A preview card uses your bg, fg, primary, border and radius tokens if you define them.

How to use it

  1. Write tokens, one per line: name: light | dark.
  2. Choose media, attribute or both.
  3. Check the sample card.
  4. Copy the CSS.

Frequently asked questions

What if a token has no dark value?

It stays the same in both modes.

How do I switch manually?

Set data-theme="dark" on the html element when you pick media + attribute or attribute.

Do I need the -- prefix?

No. It is added for you, and you can set an optional prefix.