Skip to content
ColorPicker Studio

CSS Color Generator

Pick a color and opacity to get ready-to-use CSS snippets — from simple color declarations to custom properties and modern color-mix().

CSS snippets

color
color: #2596be;
background-color
background-color: rgb(37 150 190);
border
border: 1px solid #2596be;
box-shadow
box-shadow: 0 4px 14px rgb(37 150 190 / 40%);
outline
outline: 2px solid #2596be;
text-decoration
text-decoration-color: #2596be;
custom property
:root {
  --color-brand: #2596be;
  --color-brand-rgb: 37 150 190;
}
.button {
  background: var(--color-brand);
}
hsl()
color: hsl(196, 67%, 45%);
color-mix()
background: color-mix(in oklab, #2596be 100%, white);

How to generate CSS color code

  1. 1Pick a color and set its opacity.
  2. 2Name your CSS variable.
  3. 3Copy the snippet you need.

Modern CSS color syntax

Modern CSS uses space-separated color functions with an optional slash for alpha: rgb(37 150 190 / 50%). Custom properties such as --color-brand let you define a color once and reuse it everywhere; storing RGB channels separately (--color-brand-rgb) makes it easy to create transparent variants.

color-mix(in oklab, …) blends colors directly in CSS and is supported in all current browsers — handy for hover states without hard-coding extra values.

Frequently asked questions

Should I use HEX or rgb() in CSS?

Both are identical in the browser. HEX is compact; rgb() and hsl() are easier to read and adjust, and make transparency explicit.