use-color

Type-safe CSS colors for TypeScript

OKLCH Color Space

sRGB
P3
Hue: 260°
Chroma →↑ Lightness
3D View (drag to rotate)

Loading 3D view...

62%
0.188
260°
Original
Draft
oklch(0.623 0.188 259.823)
Advanced Features

Color Harmonies

Complementary

Triadic

Split Complementary

Analogous

Tetradic

Palette Generator

Light to dark scale (like Tailwind)

vs White
vs Black
StepWhiteBlackBest
1001.316.2B
2001.712.0B
3002.48.8B
4003.36.4B
5005.04.2W
6007.72.7W
70011.71.8W
80016.51.3W
90018.21.2W
Green = AAA (7:1+)Yellow = AA (4.5:1+)Red = Fail

Color Vision Simulation

Protanopia

Red-blind (~1% of males)

Deuteranopia

Green-blind (~1% of males)

Tritanopia

Blue-blind (~0.003%)

Achromatopsia

Complete color blindness

APCA Contrast

Aa

Lc 61.3

Large Text

Aa

Lc 40.4

Large Headlines

APCA (Accessible Perceptual Contrast Algorithm)

Used in WCAG 3.0 draft

Export

:root {
  --color-primary: #3b82f6;
  --color-primary-oklch: oklch(0.623 0.188 259.823);
  --color-primary-rgb: rgb(59, 130, 246);
}

Analysis

Valid CSS
Yes
FormatHEX
Lightness62% (Light)
Luminance0.235
Contrast on white3.68:1
Contrast on black5.71:1
WCAG AA
Pass
APCA Lc61
Gamut
sRGB/P3

Conversions

HEX#3b82f6
RGBrgb(59, 130, 246)
HSLhsl(217.22, 91%, 60%)
OKLCHoklch(0.623 0.188 259.823)
P3color(display-p3 0.3047 0.5035 0.9338)

Manipulations

+0.00
+0.00
1.00

Quick Actions

Code

import { color } from 'use-color';

const c = color('#3b82f6');

c.toHex();         // "#3b82f6"
c.toOklchString(); // "oklch(0.623 0.188 259.823)"
c.getLightness();  // 0.62
c.isDark();        // false

c.lighten(0.2);    // Make lighter
c.saturate(0.2);   // More vibrant
c.rotate(30);      // Shift hue