Skip to content
colors

rgbToOklch

The `rgbToOklch` function converts RGB channel values to OKLCH, the cylindrical form of OKLab.

1 min read75 words

Function Signature

js

rgbToOklch(r: number, g: number, b: number): { L: number, C: number, h: number }

Parameters

  • r (number): Red channel value.
  • g (number): Green channel value.
  • b (number): Blue channel value.

Return Value

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

js

rgbToOklch(255, 102, 0);
// { L: 0.6958..., C: 0.2043..., h: 43.49... }

Usage Notes

  • OKLCH is useful for palette design because lightness, chroma, and hue can be adjusted separately.
  • Gray colors return hue 0 because chroma is effectively zero.

Previous

oklabToHex

Next

oklchToRgb


Herramientas destacadas

BoardlyLinksyChromoHub de Código

ReadyTools

CarrerasContactoHerramientas
Precios7 días gratis
GuíasDocsBlogUpdatesLaraVault

Seleccionar idioma

Establecer tema

© 2026 ReadyTools. Todos los derechos reservados.