CSS Color Tools
Generate CSS variables, theme blocks, Tailwind configs, borders, backgrounds, box-shadows and text color rules. Live preview, one-click copy.
var(--color-primary). Change a value once — every component updates.Why use CSS color variables?
Custom properties let you define a color once and use it everywhere. When the color needs to change — for a rebrand, a theme, or a subtle adjustment — you change one value instead of hundreds.
Building a theme system
A simple theme system uses two layers:
-
Primitive tokensRaw color values such as
--color-blue-500. These never change between themes. -
Semantic tokensRole-based names such as
--color-primary,--color-backgroundor--color-text. These are the variables your components use, and they are what themes override.
With this structure, switching themes is a matter of overriding semantic tokens under a [data-theme="dark"] selector — no component changes required.
Practical examples
:root {
--color-primary: #4f46e5;
--color-secondary: #0ea5e9;
--color-background: #ffffff;
--color-text: #111827;
}
[data-theme="dark"] {
--color-background: #0b0f17;
--color-text: #f1f5f9;
}
.button {
background-color: var(--color-primary);
color: white;
}
body {
background-color: var(--color-background);
color: var(--color-text);
}
Frequently asked questions
What browsers support CSS variables?
All modern browsers — Chrome, Firefox, Safari, Edge — support CSS custom properties. Internet Explorer does not, but no supported browser is missing this feature.
Can I use color variables inside gradients?
Yes. background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)); works in every browser that supports custom properties.
How do I make a shadow with a color tint?
Use any CSS color — hex, rgb, hsl, or the modern space-separated syntax. For subtle depth, keep the alpha between 0.08 and 0.2 and use a color that is a slightly darker or hue-shifted version of the surface.
Does the tool work offline?
Yes. Everything is computed locally in your browser — no upload, no server round-trip.