Skip to content
color-kitnext
StartAPI
color-kit on GitHub
Start

Concepts

  • OKLCH-canonical
  • Requested vs displayed
  • Planes and queries
  • Gamut and tolerance
  • Contrast

Guides

  • Headless picker
  • React
  • Contrast-aware palettes
  • GPU and three.js
  • Performance

API

  • Overview
  • @pbroom/color-kit
      • ffunctiontoRgb
      • ffunctionfromRgb
      • ffunctiontoHex
      • ffunctionfromHex
      • ffunctiontoHsl
      • ffunctionfromHsl
      • ffunctiontoHsv
      • ffunctionfromHsv
      • ffunctiontoHct
      • ffunctionfromHct
      • ffunctiontoOklab
      • ffunctionfromOklab
      • ffunctiontoOklch
      • ffunctionfromOklch
      • ffunctiontoP3
      • ffunctionfromP3
      • ffunctiontoCss
      • ffunctionparse
      • ffunctiontryParse
      • ffunctionsrgbToLinear
      • ffunctionlinearToSrgb
      • ffunctionrgbToHex
      • ffunctionhexToRgb
      • ffunctionrgbToHsl
      • ffunctionhslToRgb
      • ffunctionrgbToHsv
      • ffunctionhsvToRgb
      • ffunctionlinearRgbToOklab
      • ffunctionoklabToLinearRgb
      • ffunctionoklabToOklch
      • ffunctionoklchToOklab
      • ffunctionoklchToColor
      • ffunctioncolorToOklch
      • ffunctionlinearSrgbToLinearP3
      • ffunctionlinearP3ToLinearSrgb
      • ffunctionlinearP3ToP3
      • ffunctionp3ToLinearP3
      • ffunctiontoOklabInto
      • ffunctionfromOklabInto
      • ffunctiontoLinearSrgbInto
      • ffunctionfromLinearSrgbInto
      • ffunctiontoRgbInto
      • ffunctionfromRgbInto
      • ffunctiontoP3Into
      • ffunctionfromP3Into
      • ffunctionsrgbToLinearInto
      • ffunctionlinearToSrgbInto
      • ffunctionlinearRgbToOklabInto
      • ffunctionoklabToLinearRgbInto
      • ffunctionoklabToOklchInto
      • ffunctionoklchToOklabInto
      • ffunctionlinearSrgbToLinearP3Into
      • ffunctionlinearP3ToLinearSrgbInto
      • ffunctionlinearP3ToP3Into
      • ffunctionp3ToLinearP3Into
      • KconstLINEAR_SRGB_TO_LINEAR_P3
      • KconstLMS_TO_LINEAR_SRGB
      • KconstOKLAB_TO_LMS
      • TtypeCssColorFormat
      • TtypeMatrix3
  • @pbroom/color-kit/plane
  • @pbroom/color-kit/interop
  • @pbroom/color-kit/compute
  • @pbroom/color-kit/hct
  • @pbroom/color-kit/driver
  • @pbroom/color-kit/react
Map

@pbroom/color-kit/Conversion

oklchToOklab

Convert OKLCH to OKLab (a = c·cos h, b = c·sin h).

functionimport { oklchToOklab } from '@pbroom/color-kit';oklch.ts:116
function oklchToOklab(oklch: Oklch): Oklab;

Parameters

oklchOklch
OKLCH color (hue in degrees, any finite value)

Returns

OklabA new Oklab

Example

TypeScript
import { oklchToOklab } from '@pbroom/color-kit';

oklchToOklab({ l: 0.7, c: 0.1, h: 0, alpha: 1 }); // → { L: 0.7, a: 0.1, b: 0, alpha: 1 }

See also

  • oklabToOklch
  • oklchToOklabInto

Your display: detecting

MIT licensedSource