@pbroom/color-kitConversion

fromHct

Convert HCT (Material Design hue, chroma, tone) to a Color.

functionimport { fromHct } from '@pbroom/color-kit';index.ts:267
function fromHct(hct: Hct): Color;

Uses Material's Hct.from() solver, which reduces chroma to fit sRGB at the requested hue and tone and yields an 8-bit sRGB color, so the result is always in the sRGB gamut and quantized to 8-bit.

Parameters

hctHct
HCT color

Returns

ColorA new OKLCH Color

Example

TypeScript
import { fromHct, toHex } from '@pbroom/color-kit';

toHex(fromHct({ h: 280, c: 40, t: 60, alpha: 1 })); // → '#838cd0'

See also