HEX to OKLCH: #BA55D3

Also known as: CSS mediumorchid

Result

#BA55D3 → oklch(0.626 0.202 319.2)

Values are shown at full precision, so converting back gives exactly #ba55d3. 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: 186/255 = 0.72941 → 0.491021  (((x + 0.055) / 1.055)^2.4)
    G: 85/255 = 0.33333 → 0.090842  (((x + 0.055) / 1.055)^2.4)
    B: 211/255 = 0.82745 → 0.651406  (((x + 0.055) / 1.055)^2.4)
  2. 2. linear sRGB → LMS

    l = 0.4122·R + 0.5363·G + 0.0514·B = 0.284643
    m = 0.2119·R + 0.6807·G + 0.1074·B = 0.235844
    s = 0.0883·R + 0.2817·G + 0.6300·B = 0.479322
  3. 3. cube root

    l′ = ∛0.284643 = 0.657809
    m′ = ∛0.235844 = 0.617838
    s′ = ∛0.479322 = 0.782605
  4. 4. LMS′ → Oklab

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

    C = √(a² + b²) = 0.20244
    H = atan2(b, a) = 319.226°
    L = 0.62558
  6. 6. OKLCH

    oklch(0.62558 0.20244 319.226)
    rounded: oklch(0.626 0.202 319.2)

All formats

HEX
#ba55d3
RGB
rgb(186 85 211)
RGB (legacy)
rgb(186, 85, 211)
HSL
hsl(288.10 58.88% 58.04%) → hsl(288 59% 58%)
HWB
hwb(288 33% 17%)
OKLCH
oklch(0.626 0.202 319.2) · oklch(62.6% 0.202 319.2)
OKLab
oklab(0.626 0.153 -0.132)
Lab (D50)
lab(53.37 55.02 -47.45)
LCH (D50)
lch(53.37 72.66 319.23)
Display P3
color(display-p3 0.6800 0.3561 0.8025)
Linear sRGB
color(srgb-linear 0.4910 0.0908 0.6514)

Gamut: sRGB and Display P3

#BA55D3 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.301 and Display P3 reaches 0.324; this color uses 67% of the sRGB chroma available.

CSS snippets

.element {
  color: #ba55d3;
  color: rgb(186 85 211);
  color: hsl(288 59% 58%);
  color: oklch(0.626 0.202 319.2);
}

/* Tailwind CSS v4 */
@theme {
  --color-brand: oklch(0.626 0.202 319.2);
}
/* arbitrary values */
class="text-[#ba55d3] bg-[oklch(0.626_0.202_319.2)]"

/* wide-gamut screens */
@media (color-gamut: p3) {
  .element { color: color(display-p3 0.6800 0.3561 0.8025); }
}

/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #ba55d3 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

  • #CE68E7 · oklch(0.686 0.202 319.2) · ΔL +0.06
  • #A741BF · oklch(0.566 0.202 319.2) · ΔL −0.06

Open in the studio

Other converters for this color

All converters →

Guides: What is OKLCH?