@pbroom/color-kit/planeQueries

runPlaneQueries

Runs several plane queries against one plane, in order.

functionimport { runPlaneQueries } from '@pbroom/color-kit/plane';query.ts:120
function runPlaneQueries(
  planeDefinition: PlaneDefinition,
  queries: PlaneQuery[],
): PlaneQueryResult[];

Equivalent to mapping runPlaneQuery over queries.

Parameters

queriesPlaneQuery[]
Query payloads to run.

Returns

PlaneQueryResult[]A new array with one result per query, in input order.

Throws

  • When a query's gamut is not 'srgb' or 'display-p3'.
  • When a query kind is unknown or the plane or query options are invalid.

Example

TypeScript
import { definePlane, runPlaneQueries } from '@pbroom/color-kit/plane';

const plane = definePlane({ fixed: { h: 264 } });
const results = runPlaneQueries(plane, [
  { kind: 'gamutBoundary', gamut: 'display-p3' },
  { kind: 'chromaBand', requestedChroma: 0.1 },
]);
results.map((result) => result.kind); // → ['gamutBoundary', 'chromaBand']

Also exported from