diff options
author | Jan-Olof Eriksson <jan-olof.eriksson@iki.fi> | 2024-03-04 18:11:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 18:11:00 +0200 |
commit | e724ab812346b4224b3efb2de0960f2cda88861b (patch) | |
tree | 9192c98b2b0b4be3388019b15b02a5d7df7fcce2 /src/alf/util/colorGeneration.ts | |
parent | 963a44ab872a1044d6997a8fcf7b2fc754ac618a (diff) | |
parent | b70c404d4b369d6fab0dfbafd6b31390ffd20014 (diff) | |
download | voidsky-e724ab812346b4224b3efb2de0960f2cda88861b.tar.zst |
Merge branch 'bluesky-social:main' into main
Diffstat (limited to 'src/alf/util/colorGeneration.ts')
-rw-r--r-- | src/alf/util/colorGeneration.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/alf/util/colorGeneration.ts b/src/alf/util/colorGeneration.ts new file mode 100644 index 000000000..929a01d3a --- /dev/null +++ b/src/alf/util/colorGeneration.ts @@ -0,0 +1,17 @@ +export const BLUE_HUE = 211 +export const RED_HUE = 346 +export const GREEN_HUE = 152 + +/** + * Smooth progression of lightness "stops" for generating HSL colors. + */ +export const COLOR_STOPS = [ + 0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.85, 0.9, 0.95, 1, +] + +export function generateScale(start: number, end: number) { + const range = end - start + return COLOR_STOPS.map(stop => { + return start + range * stop + }) +} |