Pick & Convert
CSS Color Generator
Pick a color to get copy-ready CSS: every format, a custom property, and snippets for text, backgrounds, borders, shadows and button states.
Letters, numbers and hyphens. It is cleaned automatically.
Color formats
Ready-to-use snippets
Your colors and images stay in your browser. Nothing is uploaded or stored on our servers.
How to use the CSS Color Generator
- Choose a color with the picker or type any HEX, rgb() or hsl() value.
- Type a custom property name such as --brand. It is cleaned up automatically.
- Copy a single snippet with its Copy button, or choose Copy all snippets.
- Paste the code into your stylesheet and adjust the selectors to match your markup.
Examples
Custom property
For #4169E1 and the name --brand you get :root { --brand: #4169E1; } and color: var(--brand); ready to use anywhere in your CSS.
Button states
The hover snippet darkens #4169E1 by 12% to #395CC6, and the active state darkens it by 24% to #3150AB. The text color switches between white and black to keep the label readable.
A colored shadow
The box-shadow snippet uses the same color at 35% opacity, rgba(65, 105, 225, 0.35), which looks cleaner under a colored button than a plain gray shadow.
Tips
- Define brand colors once as custom properties and reference them everywhere, so a rebrand is a one-line change.
- Use the HSL line when you want to tweak lightness by hand without recalculating HEX.
Questions about the CSS Color Generator
What is a CSS custom property?
A named value such as --brand that you define once, usually in :root, and reuse with var(--brand). Change it in one place and every use updates.
Does color-mix() work in every browser?
It works in current versions of Chrome, Edge, Firefox and Safari. For very old browsers, put a plain HEX declaration before it as a fallback.
Which format should I use in CSS: HEX, RGB or HSL?
Any of them. HEX is compact, HSL is easier to adjust by hand and rgb() with an alpha value is handy for transparency.
Are the generated hover colors accessible?
Darker shades usually keep or improve contrast with white text, but always run the final pair through the contrast checker.
Related tools
Color Picker
Pick any color and copy its HEX, RGB, HSL and CMYK values.
Color Converter
Convert between HEX, RGB, HSL, HSV, HWB and CMYK instantly.
Gradient Generator
Build linear and radial CSS gradients with multiple color stops.
Contrast Checker
Check text and background contrast against WCAG AA and AAA.