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

fromOklab

Convert OKLab to a Color. Achromatic results (chroma at or below ACHROMATIC_CHROMA_THRESHOLD) get hue 0.

functionimport { fromOklab } from '@pbroom/color-kit';index.ts:339
function fromOklab(lab: Oklab): Color;

Parameters

labOklab
OKLab color

Returns

ColorA new OKLCH Color

Example

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

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

See also

  • toOklab
  • fromOklabInto

Your display: detecting

MIT licensedSource