@pbroom/color-kitUtilities

normalizeHue

Wrap a hue in degrees into [0, 360). Negative and multi-turn values are accepted.

functionimport { normalizeHue } from '@pbroom/color-kit';index.ts:72
function normalizeHue(hue: number): number;

Parameters

huenumber
Hue in degrees

Returns

numberThe equivalent hue in [0, 360)

Example

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

normalizeHue(-30); // → 330
normalizeHue(370); // → 10