HEX to OKLCH: #312E81
Also known as: Tailwind v3 indigo-900
Result
#312E81 → oklch(0.359 0.135 278.7)
Values are shown at full precision, so converting back gives exactly #312e81. 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: 49/255 = 0.19216 → 0.030713 (((x + 0.055) / 1.055)^2.4) G: 46/255 = 0.18039 → 0.027321 (((x + 0.055) / 1.055)^2.4) B: 129/255 = 0.50588 → 0.219526 (((x + 0.055) / 1.055)^2.4)
2. linear sRGB → LMS
l = 0.4122·R + 0.5363·G + 0.0514·B = 0.038608 m = 0.2119·R + 0.6807·G + 0.1074·B = 0.048682 s = 0.0883·R + 0.2817·G + 0.6300·B = 0.148706
3. cube root
l′ = ∛0.038608 = 0.337980 m′ = ∛0.048682 = 0.365137 s′ = ∛0.148706 = 0.529797
4. LMS′ → Oklab
L = 0.2105·l′ + 0.7936·m′ − 0.0041·s′ = 0.35875 a = 1.9780·l′ − 2.4286·m′ + 0.4506·s′ = 0.02048 b = 0.0259·l′ + 0.7828·m′ − 0.8087·s′ = -0.13386
5. Oklab → OKLCH
C = √(a² + b²) = 0.13542 H = atan2(b, a) = 278.697° L = 0.35875
6. OKLCH
oklch(0.35875 0.13542 278.697) rounded: oklch(0.359 0.135 278.7)
All formats
- HEX
- #312e81
- RGB
- rgb(49 46 129)
- RGB (legacy)
- rgb(49, 46, 129)
- HSL
- hsl(242.17 47.43% 34.31%) → hsl(242 47% 34%)
- HWB
- hwb(242 18% 49%)
- OKLCH
- oklch(0.359 0.135 278.7) · oklch(35.9% 0.135 278.7)
- OKLab
- oklab(0.359 0.020 -0.134)
- Lab (D50)
- lab(23.58 22.24 -47.48)
- LCH (D50)
- lch(23.58 52.43 295.09)
- Display P3
- color(display-p3 0.1901 0.1808 0.4872)
- Linear sRGB
- color(srgb-linear 0.0307 0.0273 0.2195)
Gamut: sRGB and Display P3
#312E81 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.219 and Display P3 reaches 0.222; this color uses 62% of the sRGB chroma available.
CSS snippets
.element {
color: #312e81;
color: rgb(49 46 129);
color: hsl(242 47% 34%);
color: oklch(0.359 0.135 278.7);
}
/* Tailwind CSS v4 */
@theme {
--color-brand: oklch(0.359 0.135 278.7);
}
/* arbitrary values */
class="text-[#312e81] bg-[oklch(0.359_0.135_278.7)]"
/* wide-gamut screens */
@media (color-gamut: p3) {
.element { color: color(display-p3 0.1901 0.1808 0.4872); }
}
/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #312e81 calc(l - 0.1) c h); }Nearby colors
Closest colors in the Tailwind and CSS named palettes (OKLab distance).
- indigo-900#312C85
- v3 blue-900#1E3A8A
- blue-900#1C398E
- v3 indigo-800#3730A3
- darkslateblue#483D8B
- v3 violet-900#4C1D95
- violet-900#4D179A
- indigo-800#372AAC
Lighter and darker, same hue and chroma
- #3F4094 · oklch(0.419 0.135 278.7) · ΔL +0.06
- #241C6E · oklch(0.299 0.135 278.7) · ΔL −0.06
Open in the studio
Other converters for this color
Guides: What is OKLCH?