@pbroom/color-kit/planeQueries

inspectPlaneQueries

Runs several plane queries in order, returning a result and trace for each.

functionimport { inspectPlaneQueries } from '@pbroom/color-kit/plane';query.ts:228
function inspectPlaneQueries(
  planeDefinition: PlaneDefinition,
  queries: PlaneQuery[],
  options?: PlaneQueryTraceOptions,
): PlaneQueryInspection<PlaneQueryResult>[];

Equivalent to mapping inspectPlaneQuery over queries with the same trace options; each query gets its own independent trace.

Parameters

queriesPlaneQuery[]
Query payloads to run.
options?PlaneQueryTraceOptions
Trace detail applied to every query; see inspectPlaneQuery.

Returns

PlaneQueryInspection<PlaneQueryResult>[]A new array of { result, trace } pairs, 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 { parse } from '@pbroom/color-kit';
import { definePlane, inspectPlaneQueries } from '@pbroom/color-kit/plane';

const plane = definePlane({ fixed: { h: 264 } });
const inspections = inspectPlaneQueries(
  plane,
  [
    { kind: 'gamutBoundary' },
    { kind: 'contrastRegion', reference: parse('#ffffff') },
  ],
  { level: 'summary' },
);
inspections.map(({ trace }) => trace.summary.resultPointCount); // → [101, 53]
inspections.map(({ trace }) => trace.stages.length); // → [0, 0]

Also exported from