HEX to OKLCH: #8A2BE2
Also known as: CSS blueviolet
Result
#8A2BE2 → oklch(0.534 0.250 301.4)
Values are shown at full precision, so converting back gives exactly #8a2be2. 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: 138/255 = 0.54118 → 0.254152 (((x + 0.055) / 1.055)^2.4) G: 43/255 = 0.16863 → 0.024158 (((x + 0.055) / 1.055)^2.4) B: 226/255 = 0.88627 → 0.760525 (((x + 0.055) / 1.055)^2.4)
2. linear sRGB → LMS
l = 0.4122·R + 0.5363·G + 0.0514·B = 0.156849 m = 0.2119·R + 0.6807·G + 0.1074·B = 0.151978 s = 0.0883·R + 0.2817·G + 0.6300·B = 0.508362
3. cube root
l′ = ∛0.156849 = 0.539297 m′ = ∛0.151978 = 0.533654 s′ = ∛0.508362 = 0.798101
4. LMS′ → Oklab
L = 0.2105·l′ + 0.7936·m′ − 0.0041·s′ = 0.53376 a = 1.9780·l′ − 2.4286·m′ + 0.4506·s′ = 0.13032 b = 0.0259·l′ + 0.7828·m′ − 0.8087·s′ = -0.21371
5. Oklab → OKLCH
C = √(a² + b²) = 0.25031 H = atan2(b, a) = 301.375° L = 0.53376
6. OKLCH
oklch(0.53376 0.25031 301.375) rounded: oklch(0.534 0.250 301.4)
All formats
- HEX
- #8a2be2
- RGB
- rgb(138 43 226)
- RGB (legacy)
- rgb(138, 43, 226)
- HSL
- hsl(271.15 75.93% 52.75%) → hsl(271 76% 53%)
- HWB
- hwb(271 17% 11%)
- OKLCH
- oklch(0.534 0.250 301.4) · oklch(53.4% 0.250 301.4)
- OKLab
- oklab(0.534 0.130 -0.214)
- Lab (D50)
- lab(41.21 63.01 -75.96)
- LCH (D50)
- lch(41.21 98.69 309.68)
- Display P3
- color(display-p3 0.4992 0.1957 0.8535)
- Linear sRGB
- color(srgb-linear 0.2542 0.0242 0.7605)
Gamut: sRGB and Display P3
#8A2BE2 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.295; this color uses 89% of the sRGB chroma available.
CSS snippets
.element {
color: #8a2be2;
color: rgb(138 43 226);
color: hsl(271 76% 53%);
color: oklch(0.534 0.250 301.4);
}
/* Tailwind CSS v4 */
@theme {
--color-brand: oklch(0.534 0.250 301.4);
}
/* arbitrary values */
class="text-[#8a2be2] bg-[oklch(0.534_0.250_301.4)]"
/* wide-gamut screens */
@media (color-gamut: p3) {
.element { color: color(display-p3 0.4992 0.1957 0.8535); }
}
/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #8a2be2 calc(l - 0.1) c h); }Nearby colors
Closest colors in the Tailwind and CSS named palettes (OKLab distance).
- v3 purple-600#9333EA
- v3 violet-600#7C3AED
- purple-700#8200DB
- v3 purple-700#7E22CE
- darkviolet#9400D3
- purple-600#9810FA
- darkorchid#9932CC
- violet-600#7F22FE
Lighter and darker, same hue and chroma
- #9C44F7 · oklch(0.594 0.250 301.4) · ΔL +0.06
- #7901CD · oklch(0.474 0.250 301.4) · ΔL −0.06
Open in the studio
Other converters for this color
Guides: What is OKLCH?