Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
8559cde
1
Parent(s):
7426207
Update javascript/app.js
Browse files- javascript/app.js +23 -18
javascript/app.js
CHANGED
@@ -169,24 +169,29 @@ class MidiVisualizer extends HTMLElement{
|
|
169 |
}
|
170 |
|
171 |
getColor(track, channel) {
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
//
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
190 |
}
|
191 |
|
192 |
|
|
|
169 |
}
|
170 |
|
171 |
getColor(track, channel) {
|
172 |
+
const colors = [
|
173 |
+
[255, 0, 0], // Red
|
174 |
+
[255, 255, 0], // Yellow
|
175 |
+
[0, 128, 0], // Green
|
176 |
+
[0, 255, 255], // Cyan
|
177 |
+
[0, 0, 255], // Blue
|
178 |
+
[255, 192, 203], // Pink
|
179 |
+
[255, 165, 0], // Orange
|
180 |
+
[128, 0, 128], // Purple
|
181 |
+
[128, 128, 128], // Gray
|
182 |
+
[255, 255, 255], // White
|
183 |
+
[255, 215, 0], // Gold
|
184 |
+
[192, 192, 192] // Silver
|
185 |
+
];
|
186 |
+
|
187 |
+
// Calculate an index based on the track and channel
|
188 |
+
const index = (track + channel) % colors.length;
|
189 |
+
|
190 |
+
// Get the RGB values from the colors array
|
191 |
+
const [r, g, b] = colors[index];
|
192 |
+
|
193 |
+
// Return the RGB color in the format "rgb(r, g, b)"
|
194 |
+
return `r: ${r}, g: ${g}, b: ${b})`;
|
195 |
}
|
196 |
|
197 |
|