Skip to content

Initial LCH-to-RGB functions

Compare
Choose a tag to compare
@mirisuzanne mirisuzanne released this 06 Apr 17:28
· 36 commits to master since this release

In the main public API:

@use <'path/to>/blend';

Functions:

  • blend.lch(65% 75 0) with optional alpha blend.lch(10% 15 280, 85%), returns a Sass color

Config: $gamut-correct

  • true [default]: Chroma is reduced until in-gamut
  • false: Individual RGB channels will be clipped
  • null: Return null for out-of-gamut colors

If you want more explicit control,
use <path/to>/blend/sass/lab/lch,
and access several functions directly:

  • lch.to-rgb() does the conversion math on an array of channels
  • lch.in-gamut() returns either the converted channels
    or null for out-of-gamut colors
  • lch.gamut-correct() uses chroma-reduction to get a color in-gamut
  • lch.color() takes LCH input and returns a Sass color
    based on the chosen form of gamut-correction