HEX to OKLCH: #7F22FE

Also known as: Tailwind violet-600

Result

#7F22FE → oklch(0.540 0.281 292.9)

Values are shown at full precision, so converting back gives exactly #7f22fe. The rounded form is what you normally paste into CSS.

Step-by-step math

Every number below is computed from the input, nothing is looked up.

  1. 1. sRGB → linear

    R: 127/255 = 0.49804 → 0.212231  (((x + 0.055) / 1.055)^2.4)
    G: 34/255 = 0.13333 → 0.015996  (((x + 0.055) / 1.055)^2.4)
    B: 254/255 = 0.99608 → 0.991102  (((x + 0.055) / 1.055)^2.4)
  2. 2. linear sRGB → LMS

    l = 0.4122·R + 0.5363·G + 0.0514·B = 0.147054
    m = 0.2119·R + 0.6807·G + 0.1074·B = 0.162302
    s = 0.0883·R + 0.2817·G + 0.6300·B = 0.647620
  3. 3. cube root

    l′ = ∛0.147054 = 0.527827
    m′ = ∛0.162302 = 0.545475
    s′ = ∛0.647620 = 0.865181
  4. 4. LMS′ → Oklab

    L = 0.2105·l′ + 0.7936·m′ − 0.0041·s′ = 0.54046
    a = 1.9780·l′ − 2.4286·m′ + 0.4506·s′ = 0.10915
    b = 0.0259·l′ + 0.7828·m′ − 0.8087·s′ = -0.25900
  5. 5. Oklab → OKLCH

    C = √(a² + b²) = 0.28106
    H = atan2(b, a) = 292.852°
    L = 0.54046
  6. 6. OKLCH

    oklch(0.54046 0.28106 292.852)
    rounded: oklch(0.540 0.281 292.9)

All formats

HEX
#7f22fe
RGB
rgb(127 34 254)
RGB (legacy)
rgb(127, 34, 254)
HSL
hsl(265.36 99.10% 56.47%) → hsl(265 99% 56%)
HWB
hwb(265 13% 0%)
OKLCH
oklch(0.540 0.281 292.9) · oklch(54.0% 0.281 292.9)
OKLab
oklab(0.540 0.109 -0.259)
Lab (D50)
lab(41.02 68.96 -92.12)
LCH (D50)
lch(41.02 115.07 306.82)
Display P3
color(display-p3 0.4582 0.1621 0.9580)
Linear sRGB
color(srgb-linear 0.2122 0.0160 0.9911)

Gamut: sRGB and Display P3

#7F22FE is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.283 and Display P3 reaches 0.304; this color uses 99% of the sRGB chroma available.

CSS snippets

.element {
  color: #7f22fe;
  color: rgb(127 34 254);
  color: hsl(265 99% 56%);
  color: oklch(0.540 0.281 292.9);
}

/* Tailwind CSS v4 */
@theme {
  --color-brand: oklch(0.540 0.281 292.9);
}
/* arbitrary values */
class="text-[#7f22fe] bg-[oklch(0.540_0.281_292.9)]"

/* wide-gamut screens */
@media (color-gamut: p3) {
  .element { color: color(display-p3 0.4582 0.1621 0.9580); }
}

/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #7f22fe calc(l - 0.1) c h); }

Nearby colors

Closest colors in the Tailwind and CSS named palettes (OKLab distance).

Lighter and darker, same hue and chroma

  • #8F40FF · oklch(0.600 0.281 292.9) · ΔL +0.06
  • #6F00E8 · oklch(0.480 0.281 292.9) · ΔL −0.06

Open in the studio

Other converters for this color

All converters →

Guides: What is OKLCH?