@pbroom/color-kit/planeCompile

toSvgCompoundPath

Compiles several point lists into one compound SVG path d string.

functionimport { toSvgCompoundPath } from '@pbroom/color-kit/plane';compile.ts:112
function toSvgCompoundPath(
  paths: PlanePoint[][],
  options?: SvgPathCompileOptions,
): string;

Each list becomes a subpath formatted as in toSvgPath; lists with fewer than two points are skipped. Use it for multi-path query output such as a gamut region's visibleRegion.paths or a contrast region's paths.

Parameters

pathsPlanePoint[][]
Point lists in normalized plane coordinates.
options?SvgPathCompileOptionsdefault {}
Formatting options applied to every subpath; see SvgPathCompileOptions.

Returns

stringThe path data string, subpaths separated by spaces.

Example

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

const region = getPlaneGamutRegion(definePlane({ fixed: { h: 264 } }));
const d = toSvgCompoundPath(region.visibleRegion.paths, { closeLoop: true });
// → 'M 50.000 29.736 L … Z' (one closed subpath)

Also exported from