@pbroom/color-kit/interopReaders

fromP3Array

Read a color from gamma-encoded Display P3 [r, g, b] (0–1) stored in any array-like (number[], Float32Array, ...). Alpha is 1; use fromP3Array4 to read [c0, c1, c2, alpha].

functionimport { fromP3Array } from '@pbroom/color-kit/interop';readers.ts:142
function fromP3Array(  array: ArrayLike<number>, ,  offset?: number,): Color;

Parameters

arrayArrayLike<number>
Source array.
offset?numberdefault 0
Index in array of the first component.

Returns

ColorA new Color (OKLCH).

Example

TypeScript
const color = fromP3Array(buffer, 6);

Also exported from