HEX to OKLCH: #581C87
Also known as: Tailwind v3 purple-900
Result
#581C87 → oklch(0.381 0.166 305.0)
Values are shown at full precision, so converting back gives exactly #581c87. 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. sRGB → linear
R: 88/255 = 0.34510 → 0.097587 (((x + 0.055) / 1.055)^2.4) G: 28/255 = 0.10980 → 0.011612 (((x + 0.055) / 1.055)^2.4) B: 135/255 = 0.52941 → 0.242281 (((x + 0.055) / 1.055)^2.4)
2. linear sRGB → LMS
l = 0.4122·R + 0.5363·G + 0.0514·B = 0.058920 m = 0.2119·R + 0.6807·G + 0.1074·B = 0.054604 s = 0.0883·R + 0.2817·G + 0.6300·B = 0.164521
3. cube root
l′ = ∛0.058920 = 0.389124 m′ = ∛0.054604 = 0.379380 s′ = ∛0.164521 = 0.547949
4. LMS′ → Oklab
L = 0.2105·l′ + 0.7936·m′ − 0.0041·s′ = 0.38074 a = 1.9780·l′ − 2.4286·m′ + 0.4506·s′ = 0.09523 b = 0.0259·l′ + 0.7828·m′ − 0.8087·s′ = -0.13607
5. Oklab → OKLCH
C = √(a² + b²) = 0.16608 H = atan2(b, a) = 304.987° L = 0.38074
6. OKLCH
oklch(0.38074 0.16608 304.987) rounded: oklch(0.381 0.166 305.0)
All formats
- HEX
- #581c87
- RGB
- rgb(88 28 135)
- RGB (legacy)
- rgb(88, 28, 135)
- HSL
- hsl(273.64 65.64% 31.96%) → hsl(274 66% 32%)
- HWB
- hwb(274 11% 47%)
- OKLCH
- oklch(0.381 0.166 305.0) · oklch(38.1% 0.166 305.0)
- OKLab
- oklab(0.381 0.095 -0.136)
- Lab (D50)
- lab(25.18 42.12 -48.39)
- LCH (D50)
- lch(25.18 64.15 311.03)
- Display P3
- color(display-p3 0.3177 0.1256 0.5097)
- Linear sRGB
- color(srgb-linear 0.0976 0.0116 0.2423)
Gamut: sRGB and Display P3
#581C87 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.198 and Display P3 reaches 0.208; this color uses 84% of the sRGB chroma available.
CSS snippets
.element {
color: #581c87;
color: rgb(88 28 135);
color: hsl(274 66% 32%);
color: oklch(0.381 0.166 305.0);
}
/* Tailwind CSS v4 */
@theme {
--color-brand: oklch(0.381 0.166 305.0);
}
/* arbitrary values */
class="text-[#581c87] bg-[oklch(0.381_0.166_305.0)]"
/* wide-gamut screens */
@media (color-gamut: p3) {
.element { color: color(display-p3 0.3177 0.1256 0.5097); }
}
/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #581c87 calc(l - 0.1) c h); }Nearby colors
Closest colors in the Tailwind and CSS named palettes (OKLab distance).
- purple-900#59168B
- v3 violet-900#4C1D95
- violet-900#4D179A
- indigo#4B0082
- rebeccapurple#663399
- v3 fuchsia-900#701A75
- fuchsia-900#721378
- v3 purple-800#6B21A8
Lighter and darker, same hue and chroma
- #69309A · oklch(0.441 0.166 305.0) · ΔL +0.06
- #480074 · oklch(0.321 0.166 305.0) · ΔL −0.06
Open in the studio
Other converters for this color
Guides: What is OKLCH?