Skip to content
colors

hexToOklch

The `hexToOklch` function converts a HEX color directly to OKLCH.

1 min read58 words

Function Signature

js

hexToOklch(hex: string): { L: number, C: number, h: number }

Parameters

  • hex (string): HEX color string in #rgb or #rrggbb format.

Return Value

An OKLCH object with lightness L, chroma C, and hue h in degrees.

js

hexToOklch("#ff6600");
// { L: 0.6958..., C: 0.2043..., h: 43.49... }

Usage Notes

  • Useful for building perceptual palettes and modern CSS color declarations.
  • Throws if the HEX input is invalid.

Previous

oklchToRgb

Next

oklchToHex


Herramientas destacadas

BoardlyLinksyChromoHub de Código

ReadyTools

CarrerasContactoHerramientas
Precios7 días gratis
GuíasDocsBlogUpdatesLaraVault

Seleccionar idioma

Establecer tema

© 2026 ReadyTools. Todos los derechos reservados.