HEX to OKLCH: #1F2937
Also known as: Tailwind v3 gray-800
Result
#1F2937 → oklch(0.278 0.030 256.8)
Values are shown at full precision, so converting back gives exactly #1f2937. 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: 31/255 = 0.12157 → 0.013702 (((x + 0.055) / 1.055)^2.4) G: 41/255 = 0.16078 → 0.022174 (((x + 0.055) / 1.055)^2.4) B: 55/255 = 0.21569 → 0.038204 (((x + 0.055) / 1.055)^2.4)
2. linear sRGB → LMS
l = 0.4122·R + 0.5363·G + 0.0514·B = 0.019506 m = 0.2119·R + 0.6807·G + 0.1074·B = 0.022100 s = 0.0883·R + 0.2817·G + 0.6300·B = 0.031525
3. cube root
l′ = ∛0.019506 = 0.269190 m′ = ∛0.022100 = 0.280629 s′ = ∛0.031525 = 0.315900
4. LMS′ → Oklab
L = 0.2105·l′ + 0.7936·m′ − 0.0041·s′ = 0.27808 a = 1.9780·l′ − 2.4286·m′ + 0.4506·s′ = -0.00673 b = 0.0259·l′ + 0.7828·m′ − 0.8087·s′ = -0.02882
5. Oklab → OKLCH
C = √(a² + b²) = 0.02960 H = atan2(b, a) = 256.848° L = 0.27808
6. OKLCH
oklch(0.27808 0.02960 256.848) rounded: oklch(0.278 0.030 256.8)
All formats
- HEX
- #1f2937
- RGB
- rgb(31 41 55)
- RGB (legacy)
- rgb(31, 41, 55)
- HSL
- hsl(215.00 27.91% 16.86%) → hsl(215 28% 17%)
- HWB
- hwb(215 12% 78%)
- OKLCH
- oklch(0.278 0.030 256.8) · oklch(27.8% 0.030 256.8)
- OKLab
- oklab(0.278 -0.007 -0.029)
- Lab (D50)
- lab(16.14 -1.18 -10.57)
- LCH (D50)
- lch(16.14 10.64 263.63)
- Display P3
- color(display-p3 0.1294 0.1596 0.2110)
- Linear sRGB
- color(srgb-linear 0.0137 0.0222 0.0382)
Gamut: sRGB and Display P3
#1F2937 is a hex color, so it sits inside sRGB and therefore inside Display P3. At this lightness and hue, sRGB reaches chroma 0.098 and Display P3 reaches 0.125; this color uses 30% of the sRGB chroma available.
CSS snippets
.element {
color: #1f2937;
color: rgb(31 41 55);
color: hsl(215 28% 17%);
color: oklch(0.278 0.030 256.8);
}
/* Tailwind CSS v4 */
@theme {
--color-brand: oklch(0.278 0.030 256.8);
}
/* arbitrary values */
class="text-[#1f2937] bg-[oklch(0.278_0.030_256.8)]"
/* wide-gamut screens */
@media (color-gamut: p3) {
.element { color: color(display-p3 0.1294 0.1596 0.2110); }
}
/* relative color syntax: 10% darker */
.element-dark { color: oklch(from #1f2937 calc(l - 0.1) c h); }Nearby colors
Closest colors in the Tailwind and CSS named palettes (OKLab distance).
- gray-800#1E2939
- v3 slate-800#1E293B
- slate-800#1D293D
- mist-800#22292B
- zinc-800#27272A
- neutral-800#262626
- mauve-800#2A212C
- stone-800#292524
Lighter and darker, same hue and chroma
- #2E3847 · oklch(0.338 0.030 256.8) · ΔL +0.06
- #111B28 · oklch(0.218 0.030 256.8) · ΔL −0.06
Open in the studio
Other converters for this color
Guides: What is OKLCH?