shadcnthemes
All tools

OKLCH color converter for shadcn/ui

Convert hex, HSL and RGB colors to OKLCH, and back, for Tailwind v4 and shadcn/ui. Convert one color or a whole list of CSS variables at once.

OKLCHoklch(0.6231 0.188 259.81)
Hex#3b82f6
RGBrgb(59, 130, 246)
HSLhsl(217.22, 91.22%, 59.8%)
Tailwind v3 channels217.2 91.2% 59.8%
CSS variable--primary: oklch(0.6231 0.188 259.81);

How it works

  1. 1

    Enter any CSS color, such as #3b82f6, rgb(59 130 246), hsl(217 91% 60%), oklch(0.62 0.19 260) or a bare v3 channel like 217 91% 60%.

  2. 2

    Copy it in whichever format you need, including a ready-to-paste CSS variable.

  3. 3

    Switch to batch mode to convert a whole block of --variable: value; lines in one go.

FAQ

Why does Tailwind v4 use OKLCH?

OKLCH is perceptually uniform: equal lightness values look equally light, so palettes and shades are easier to build and contrast is easier to predict. Read the OKLCH guide for details.

What do the three OKLCH numbers mean?

Lightness from 0 to 1, chroma (colorfulness, roughly 0 to 0.37) and hue as an angle from 0 to 360.

More tools