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


Top eszközök

BoardlyLinksyChromoCodeHub

ReadyTools

KarrierKapcsolatEszközök
Árak7 nap ingyen
ÚtmutatókDocsBlogUpdatesLaraVault

Nyelv kiválasztása

Téma beállítása

© 2026 ReadyTools. Minden jog fenntartva.