HEX to Decimal Color
Convert a HEX colour to the integer forms Android, Java and Unity want.
Turn a palette into CSS custom properties, Tailwind tokens or Sass.
The variables appear here
Color to CSS Variables turns a pasted palette into code: CSS custom properties, Tailwind v4 @theme tokens, Sass, Less, a JS object or W3C design tokens — with channel-split values for the opacity pattern and an optional dark mode block.
Paste a palette and get it back as code. CSS custom properties on :root, Tailwind v4 @theme tokens, Sass variables, Less variables, a JavaScript object or W3C design tokens in JSON — the same colours, in whatever form your project consumes.
Names come from your input where you give them: a line reading "Primary: #4f46e5" becomes --color-primary. Unnamed colours are numbered, and every name is normalised to the kebab-case that CSS wants, so pasting straight out of a design tool works.
The channel-split option is the one to know about. Emitting a colour as its raw components — "79 70 229" rather than "#4f46e5" — lets you write rgb(var(--color-primary) / 50%) and get opacity variants from a single token, which is how Tailwind and most modern design systems handle alpha. A dark mode block can be generated alongside, with each colour flipped in lightness and the hue left alone.
CSS custom properties, Tailwind @theme, Sass, Less, JavaScript and W3C design tokens from the same input.
Emitting "79 70 229" lets you write rgb(var(--brand) / 50%) and get every opacity from one token.
A "Primary: #4f46e5" line becomes --color-primary, normalised to kebab-case automatically.
An optional block with each colour flipped in OKLCH lightness — a starting point rather than a finished theme.
Lines split on newlines, commas and semicolons, and anything that is not a colour is skipped rather than breaking the run.
One colour per line. Add "Name: value" to keep your own names.
CSS custom properties, Tailwind @theme, Sass, Less, JS or design tokens.
HEX, or raw channels for the rgb(var(--x) / 50%) pattern.
Take the block to your clipboard or save it as a file.
Because a hex value cannot have opacity applied to it inside a variable. Storing "79 70 229" lets you write rgb(var(--color-primary) / 50%) and get every opacity variant from one token instead of defining a dozen.
Tailwind v4 defines its palette in CSS with an @theme block, so the tool emits --color-name entries there. Those immediately become bg-name, text-name and border-name utilities.
A JSON format for describing design decisions independently of any platform, standardised by the W3C Design Tokens group. Style Dictionary and similar tools read it and generate CSS, Swift, Android and more from the one file.
By inverting each colour’s lightness in OKLCH while holding hue and chroma, which keeps the palette recognisable. It is a solid starting point, not a finished dark theme — those always need hand-tuning.
What people who use the Color to CSS Variables think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the Color to CSS Variables. It takes half a minute and no account.
Write the first reviewConvert a HEX colour to the integer forms Android, Java and Unity want.
Build CSS linear and radial gradients visually and copy the code.
Convert CIELAB to HEX and RGB, and measure ΔE between colours.
Nudge a colour until it passes WCAG, keeping its hue.
Convert HSL to HEX and back, with the maths written out.
Build conic gradients — pie charts, colour wheels and sweeps.
See your colours as the eight percent of men who see them differently do.
Turn an RGBA colour into an 8-digit HEX code, or flatten the alpha away.