@pbroom/color-kit/planeCompile

resolvePlaneDefinition

Resolves a dynamic PlaneDefinition into a fully-specified Plane.

functionimport { resolvePlaneDefinition } from '@pbroom/color-kit/plane';resolve.ts:169
function resolvePlaneDefinition(  planeObject?: PlaneDefinition,): Plane;

Applies the same defaults and validation as definePlane, but accepts the broad PlaneDefinition type, so it suits definitions whose model is only known at runtime (for example, read from settings). Prefer definePlane() when the model is known at the call site: its overloads narrow channel names per model at compile time.

Parameters

planeObject?PlaneDefinitiondefault {}
Plane input. model defaults to 'oklch', omitted axes fall back to PLANE_MODEL_DEFAULT_AXES and omitted ranges to PLANE_MODEL_DEFAULT_RANGES. Channels not on an axis come from fixed, then from the anchor color, then from model defaults, and are clamped to the model's valid range.

Returns

PlaneA new resolved plane with explicit axes, ranges and fixed channels.

Throws

  • When model is not a supported plane model (including the removed 'p3' spelling; use 'display-p3').
  • When an axis or fixed channel is not valid for the model, both axes use the same channel, or a range or fixed value is not finite.

Example

TypeScript
import { resolvePlaneDefinition } from '@pbroom/color-kit/plane';

const plane = resolvePlaneDefinition({ model: 'hsv' });
plane.x; // → { channel: 'h', range: [0, 360] }
plane.y; // → { channel: 's', range: [100, 0] }
plane.fixed; // → { h: 0, s: 0, v: 50, alpha: 1 }

See also

Also exported from