From 049aa352864cd783271ad4b9bc8f1342ca6457a1 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 18 Nov 2023 21:15:52 +0100 Subject: [PATCH] hsl + hsla functions --- packages/core/pattern.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index 5a9a3fe8..9a5c456a 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -2189,6 +2189,14 @@ export const duration = register('duration', function (value, pat) { return pat.withHapSpan((span) => new TimeSpan(span.begin, span.begin.add(value))); }); +export const hsla = register('hsla', (h, s, l, a, pat) => { + return pat.color(`hsla(${h}turn,${s * 100}%,${l * 100}%,${a})`); +}); + +export const hsl = register('hsl', (h, s, l, pat) => { + return pat.color(`hsl(${h}turn,${s * 100}%,${l * 100}%)`); +}); + /** * Sets the color of the hap in visualizations like pianoroll or highlighting. * @name color