@pbroom/color-kit/interopBuffers
unpackColors
Read colors back out of a flat array written by packColors (or any buffer with the same layout).
import { unpackColors } from '@pbroom/color-kit/interop';pack.ts:197function unpackColors(
array: ArrayLike<number>,
space: ArraySpace,
options?: UnpackColorsOptions,
): Color[];Parameters
- array
ArrayLike<number> - Source array.
- space
ArraySpace - Channel layout of
array. - options?
UnpackColorsOptions - Layout options.
Returns
Color[]New Color objects (OKLCH).
Example
const packed = packColors(colors, 'oklab', undefined, { stride: 4 });
const restored = unpackColors(packed, 'oklab', { stride: 4 });Also exported from
@pbroom/color-kitthe same declaration, re-exported