Skip to main content

Function: channelGradient()

channelGradient(key, rgb, hsl): string

Defined in: src/ui/elements/PcPanelColours/index.ts:87

The CSS gradient a channel's slider track shows: the colours its values give, from the lowest to the highest, keeping the colour's other values. Red, green and blue go from none to all of that channel (e.g. red from rgb(0, g, b) to rgb(255, g, b)), saturation from grey to full colour, and lightness from black through the colour to white. Hue goes through every hue at full saturation, so it never shows as grey.

Parameters​

key​

string

rgb​

Rgb

hsl​

Hsl

Returns​

string

Example​

channelGradient("r", { r: 0, g: 128, b: 255 }, { h: 210, s: 100, l: 50 }); // "linear-gradient(to right, #0080ff, #ff80ff)"
channelGradient("s", { r: 77, g: 179, b: 77 }, { h: 120, s: 40, l: 50 }); // "linear-gradient(to right, #808080, #00ff00)"