RGBtoHSV

Color
stable

Convert an sRGB colour to HSV (hue, saturation, value). Returns a safe default {h:0, s:1, v:1, a:1} when rgba is falsy.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

rgba
required
TRGBA
sRGB colour object with r, g, b in [0, 255] and optional alpha in [0, 1].

API

Return value

The value returned by this util.

Equivalent colour in HSV space. h in [0, 360], s and v in [0, 1], a preserved from the input.

Usage

Examples

Ready-to-paste usage snippets.

Convert sRGB green to HSV

typescript