CSS :root Custom Properties Generator
Create a CSS :root block of color custom properties like --color-primary: #3B82F6. Name your colors, set a prefix and copy production-ready CSS.
Colors (5/12)
Output
:root {
--color-primary: #2563EB;
--color-secondary: #7C3AED;
--color-success: #16A34A;
--color-warning: #F59E0B;
--color-surface: #F8FAFC;
}Technical Specification & Mathematical Principles
How the CSS Variables Generator Works
CSS custom properties are declared with a double-dash name inside a selector, and :root targets the html element so the values cascade through the whole document. They are read with var(--color-primary) and, unlike preprocessor variables, can change at runtime and be overridden per component or per theme.
The generator lowercases names, replaces unsupported characters with hyphens, adds an optional prefix and normalizes every value to uppercase #RRGGBB. Duplicate names get numeric suffixes so no property is silently overwritten.
Frequently Asked Questions
Why prefix variables with --color-?
Can I switch themes with these variables?
Are custom properties case-sensitive?
Related Design & Color Instruments
SCSS Variables Generator
Generate SCSS color variables and a $colors map from named HEX colors, ready for map-get(). Instant output you can paste into any Sass project.
Design Tokens Export (DTCG JSON)
Generate W3C Design Tokens Community Group JSON for colors with $value and $type. Name up to 12 tokens and copy a spec-shaped file for Style Dictionary.
Dark Mode Surface Builder
Map layered dark background surfaces with subtle elevation highlights adhering to Material Design standards.
Tailwind Palette Generator
Generate a complete 11-step color scale (50, 100, 200, ... 950) ready to paste into your tailwind.config file.