@pbroom/color-kitConversion

toHct

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

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

Computed from the sRGB value clipped to the gamut like toRgb but not rounded to 8-bit, under Material's default viewing conditions. Tone is CIE L* (0-100).

Parameters

colorColor
Color to convert

Returns

HctA new Hct

Example

TypeScript
import { parse, toHct } from '@pbroom/color-kit';

toHct(parse('#3b82f6')); // → ≈ { h: 266.34, c: 64.16, t: 55.63, alpha: 1 }

See also