Module color.gamut

Diagnose and handle colors outside the sRGB gamut.

Use inGamut to test target-space coordinates, clip for simple hard clipping, or choose an explicit perceptual mapper for OKLCH colors. Clipping and perceptual mapping are different operations; this module deliberately has no default mapping policy.

Functions

NameDescription
clip(color) Forces finite encoded sRGB components into the representable sRGB range.
clip(color) Forces finite linear-light sRGB components into the representable range.
gamutMapLocalMindeToLinearSRgb(color) Maps an OKLCH color into linear sRGB with the Local MINDE strategy.
gamutMapLocalMindeToLinearSRgb(value) Maps a straight-alpha OKLCH color using Local MINDE.
gamutMapRayTraceToLinearSRgb(color) Maps an OKLCH color into linear sRGB with the Ray Trace strategy.
gamutMapRayTraceToLinearSRgb(value) Maps a straight-alpha OKLCH color using Ray Trace.
inGamut(color) Reports whether an encoded sRGB value is directly representable in sRGB.
inGamut(color) Reports whether a linear-light sRGB value is directly representable in sRGB.