@pbroom/color-kit/interopReaders

fromLinearSrgbArray

Read a color from linear-light sRGB [r, g, b] stored in any array-like (number[], Float32Array, ...). Alpha is 1; use fromLinearSrgbArray4 to read [c0, c1, c2, alpha].

functionimport { fromLinearSrgbArray } from '@pbroom/color-kit/interop';readers.ts:25
function fromLinearSrgbArray(
  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 = fromLinearSrgbArray(threeColor.toArray());

Also exported from