hsl
result = hsl(h, s, l)
Input: h, s, l · Output: result
What it is
Builds a colour from hue h (number, degrees, 0–360), saturation s (number, 0–1) and lightness l (number, 0–1, symmetric about 0.5 — "the same colour, lighter" is one number going up).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = hsl(h, s, l) | h numbernot documented yets numbernot documented yetl numbernot documented yet | result string | Returns a "#rrggbb" string. |
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"))
("#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
md2html(s) / html2md(s) — both directions, because either alone is a trap: forward-only leaves you HTML you cannot edit, reverse-only leaves you Markdown you cannot publish. See rgb(255, 0, 0) / rgba(255, 0, 0, 128) — a colour built from numbers, for when the channels are computed rather than typed. Returns the #rrggbb string every colour argument takes, so it composes with everything without a colour type existing. ── colour spaces ─────────────────────────────────────────── hsv(h, s, v) and hsl/lab/cmyk build a colour the way you were thinking about it and hand back the #rrggbb every colour argument takes -- so they compose with everything without a colour type having to exist. HSV is the one that earns its place: fix saturation and value, walk the hue, and you have a categorical palette whose colours all carry the same weight. Doing that in RGB means knowing the hexagon by heart.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.