HSL to HEX: #312E81

Also known as: Tailwind v3 indigo-900

Result

hsl(242.17 47.43% 34.31%) → #312E81

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. 1. input

    H = 242.17°, S = 47.43%, L = 34.31%
  2. 2. C

    C = (1 − |2L − 1|) × S = 0.32546
  3. 3. X

    X = C × (1 − |(H / 60°) mod 2 − 1|) = 0.01177   (H / 60° = 4.0362, sector 4)
  4. 4. m

    m = L − C / 2 = 0.18037
  5. 5. (R′, G′, B′) + m

    (R′, G′, B′) = (0.01177, 0.00000, 0.32546)
    R = round((0.01177 + 0.18037) × 255) = 49
    G = round((0.00000 + 0.18037) × 255) = 46
    B = round((0.32546 + 0.18037) × 255) = 129
  6. 6. RGB → HEX

    #312E81

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).

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

All converters →

Guides: What is OKLCH?