Read any notation
RgbColor.readColor() takes #a54e3c, #abc, rgb(165, 78, 60), hsl(12, 47%, 44%) or
oklch(55.7% 0.108 34.7) and hands back an RgbColor. Invalid input returns null instead of
throwing.
Read any notation
RgbColor.readColor() takes #a54e3c, #abc, rgb(165, 78, 60), hsl(12, 47%, 44%) or
oklch(55.7% 0.108 34.7) and hands back an RgbColor. Invalid input returns null instead of
throwing.
Readable text on any background
Two contrast algorithms decide whether black or white text belongs on a given background — a hex-value threshold and a WCAG relative-luminance one. The swatches in these docs are colored by the first.
Compare both algorithms →Three named palettes
The 64 colors of ColorPalette, the 286 of Tailwind CSS v4 and the 130 of Open Color — all behind one
ColorCode interface, so nearest-color lookups work across all of them.
Perceptual nearest color
getNearest() measures distance in OKLAB, where a step of the same size looks like the same
step to the eye. #3b82f6 maps to blue-500, not to whatever happens to be close in rgb.
Shades as a first-class concept
Shade maps the Tailwind steps 50–950 and the Open Color steps 0–9 onto one scale. Ask for
Shade.mids() and you get accent-strength colors from either palette.
Small
Java 11, Lombok at compile time, Jackson and swagger-annotations as optional extras. Nothing else on the classpath at runtime.
Install in one line →