@pbroom/color-kit/planeCompile
resolvePlaneDefinition
Resolves a dynamic PlaneDefinition into a fully-specified Plane.
import { resolvePlaneDefinition } from '@pbroom/color-kit/plane';resolve.ts:169function 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.
modeldefaults to'oklch', omitted axes fall back toPLANE_MODEL_DEFAULT_AXESand omitted ranges toPLANE_MODEL_DEFAULT_RANGES. Channels not on an axis come fromfixed, then from the anchorcolor, 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
modelis 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
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
@pbroom/color-kitthe same declaration, re-exported