Qu

palette

Builtin index · Plotting

result = palette(n, [saturation=, value=, start=])

Input: n, saturation · Output: result

What it is

Generates n (integer) categorical colours of equal perceptual weight by walking hue at fixed saturation/value. saturation= (default 0.62) and value= (default 0.78) are numbers 0–1; start= (default 215, degrees) is the first colour's hue.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = palette(n, [saturation=, value=, start=])
n —Generates n (integer) categorical colours of equal perceptual weight by walking hue at fixed saturation/value.
saturation number, optional (default , value=, start=)saturation= (default 0.62) and value= (default 0.78) are numbers 0–1.
result List or string
Returns a List of n "#rrggbb" strings.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

print(palette(5))
print(to_hsv("royalblue"))
print(delta_e("royalblue", "crimson"))
print(hsv(210, 0.7, 0.9))
print(hsl(210, 0.7, 0.5))
print(lab(50, 20, -30))
print(cmyk(0.1, 0.2, 0, 0.05))
print(rgb(65, 105, 225))
print(rgba(255, 0, 0, 0.5))
print(to_rgb("royalblue"))
print(to_hsl("royalblue"))
print(to_lab("royalblue"))
print(to_cmyk("royalblue"))
output
("#4c7fc7", "#ac4cc7", "#c74c4e", "#b0c74c", "#4cc77b")
[225, 0.711111, 0.882353]
108.484687
#4595e6
#2680d9
#7f6daa
#dac2f2
#4169e1
#ff000080
[65, 105, 225]
[225, 0.727273, 0.568627]
[47.830074, 26.263097, -65.263665]
[0.711111, 0.533333, 0, 0.117647]

from plotting

How it works

palette(n) — n colours that carry equal weight, by walking the hue at fixed saturation and value. The thing HSV is for, and the reason a categorical palette generated in RGB always has one colour that shouts.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.