diff options
| author | julian laplace <julescarbon@gmail.com> | 2025-07-15 14:49:01 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2025-07-15 14:49:01 +0200 |
| commit | 38b1babb974dc943d21e358c6ff63c993d747f6b (patch) | |
| tree | c504bc6d8cbb0d7afc4cff1b4eaacbf37e121c49 /client | |
| parent | b68e5f30225595abbff4b787d8348c9ea4700d1f (diff) | |
edit copy
Diffstat (limited to 'client')
| -rw-r--r-- | client/index.js | 7 | ||||
| -rw-r--r-- | client/lib/color.js | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/client/index.js b/client/index.js index a50208c..8c53cb6 100644 --- a/client/index.js +++ b/client/index.js @@ -528,7 +528,12 @@ function bindRoot() { }).forEach(([key, fn], index) => { const el = document.querySelector(`.root-select .${key}`); el.addEventListener("click", fn); - el.style.background = color(Math.pow(2, index / 12), 0, 1.6); + el.style.background = color( + Math.pow(2, index / 12), + key.length === 6 ? 0 : -0.15, + key.length === 6 ? 0.95 : 0.4, + 1, + ); }); } diff --git a/client/lib/color.js b/client/lib/color.js index bbc137e..294317e 100644 --- a/client/lib/color.js +++ b/client/lib/color.js @@ -54,7 +54,7 @@ function channel(t, a, b, c, d, add, mul) { return a + b * Math.cos(2 * Math.PI * (c * t + d)) * mul + add; } -function color(t, add, mul) { +function color(t, add, mul, alpha) { let a, b, c, d; const rgb = []; for (var i = 0; i < 3; i++) { @@ -64,6 +64,9 @@ function color(t, add, mul) { d = palette[3][i]; rgb[i] = Math.round(channel(-t, a, b, c, d, add, mul) * 255); } + if (alpha) { + return "rgba(" + rgb + "," + alpha + ")"; + } return "rgb(" + rgb + ")"; } |
