@pbroom/color-kit/interopTypes
ArrayWriteOptions
Out-of-gamut handling for the array writers.
import type { ArrayWriteOptions } from '@pbroom/color-kit/interop';types.ts:54interface ArrayWriteOptions {
clamp?: boolean;
}Gamut mapping is deliberately not an option: compose it instead, e.g. toLinearSrgbArray(toSrgbGamut(color), out) or packColors(colors.map(toSrgbGamut), 'linearSrgb'). This keeps the writers free of the gamut-mapping solver (~1 kB gzip) for callers that do not need it.
Properties
- clamp?
booleandefaultfalse Clip RGB channels to
[0, 1]after conversion. Only affects the RGB spaces (linearSrgb,srgb,linearP3,display-p3); it is a no-op foroklab/oklch. Alpha is written unchanged. Clipping shifts hue and lightness; map withtoSrgbGamut/toP3Gamutfirst to reduce chroma instead.The default (
false) writes unclamped floats, which is what HDR and linear-light GPU pipelines expect and matches three.js, which never clampsColorchannels.
Also exported from
@pbroom/color-kitthe same declaration, re-exported