summaryrefslogtreecommitdiff
path: root/client/lib/color.js
diff options
context:
space:
mode:
authorjulian laplace <julescarbon@gmail.com>2025-06-30 23:35:13 +0200
committerjulian laplace <julescarbon@gmail.com>2025-06-30 23:35:13 +0200
commite5ec8893d18aa21f771ab56fc5ded42602125f94 (patch)
treef9b95619cfa86ff6ea72302defbee5367f2d3307 /client/lib/color.js
parentdfcdf790e3879678d8b3a9b729cca03174b32d55 (diff)
fixes
Diffstat (limited to 'client/lib/color.js')
-rw-r--r--client/lib/color.js78
1 files changed, 56 insertions, 22 deletions
diff --git a/client/lib/color.js b/client/lib/color.js
index bd5b7ce..d0fdc24 100644
--- a/client/lib/color.js
+++ b/client/lib/color.js
@@ -1,31 +1,65 @@
-
const palettes = [
- [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [1.0, 1.0, 1.0], [0.00, 0.33, 0.67]],
- [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [1.0, 1.0, 1.0], [0.00, 0.10, 0.20]],
- [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [1.0, 1.0, 1.0], [0.30, 0.20, 0.20]],
- [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [1.0, 1.0, 0.5], [0.80, 0.90, 0.30]],
- [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [1.0, 0.7, 0.4], [0.00, 0.15, 0.20]],
- [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [2.0, 1.0, 0.0], [0.50, 0.20, 0.25]],
- [[0.8, 0.5, 0.4], [0.2, 0.4, 0.2], [2.0, 1.0, 1.0], [0.00, 0.25, 0.25]],
-]
+ [
+ [0.5, 0.5, 0.5],
+ [0.5, 0.5, 0.5],
+ [1.0, 1.0, 1.0],
+ [0.0, 0.33, 0.67],
+ ],
+ [
+ [0.5, 0.5, 0.5],
+ [0.5, 0.5, 0.5],
+ [1.0, 1.0, 1.0],
+ [0.0, 0.1, 0.2],
+ ],
+ [
+ [0.5, 0.5, 0.5],
+ [0.5, 0.5, 0.5],
+ [1.0, 1.0, 1.0],
+ [0.3, 0.2, 0.2],
+ ],
+ [
+ [0.5, 0.5, 0.5],
+ [0.5, 0.5, 0.5],
+ [1.0, 1.0, 0.5],
+ [0.8, 0.9, 0.3],
+ ],
+ [
+ [0.5, 0.5, 0.5],
+ [0.5, 0.5, 0.5],
+ [1.0, 0.7, 0.4],
+ [0.0, 0.15, 0.2],
+ ],
+ [
+ [0.5, 0.5, 0.5],
+ [0.5, 0.5, 0.5],
+ [2.0, 1.0, 0.0],
+ [0.5, 0.2, 0.25],
+ ],
+ [
+ [0.8, 0.5, 0.4],
+ [0.2, 0.4, 0.2],
+ [2.0, 1.0, 1.0],
+ [0.0, 0.25, 0.25],
+ ],
+];
-let palette = palettes[0]
+let palette = palettes[0];
-function channel (t, a, b, c, d, add, mul) {
- return a + b * Math.cos(2 * Math.PI * (c * t + d)) * mul + add
+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) {
- let a, b, c, d
- const rgb = []
+function color(t, add, mul) {
+ let a, b, c, d;
+ const rgb = [];
for (var i = 0; i < 3; i++) {
- a = palette[0][i]
- b = palette[1][i]
- c = palette[2][i]
- d = palette[3][i]
- rgb[i] = Math.round(channel(t, a, b, c, d, add, mul) * 255)
+ a = palette[0][i];
+ b = palette[1][i];
+ c = palette[2][i];
+ d = palette[3][i];
+ rgb[i] = Math.round(channel(t, a, b, c, d, add, mul) * 255);
}
- return 'rgb(' + rgb + ')'
+ return "rgb(" + rgb + ")";
}
-export default color
+export default color;