Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
7426207
1
Parent(s):
155209e
Update javascript/app.js
Browse files- javascript/app.js +8 -8
javascript/app.js
CHANGED
|
@@ -179,14 +179,14 @@ class MidiVisualizer extends HTMLElement{
|
|
| 179 |
}
|
| 180 |
|
| 181 |
// Function to convert a hash to an RGB color
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
}
|
| 191 |
|
| 192 |
|
|
|
|
| 179 |
}
|
| 180 |
|
| 181 |
// Function to convert a hash to an RGB color
|
| 182 |
+
hashToColor(hash) {
|
| 183 |
+
// Use bitwise operations to extract RGB components
|
| 184 |
+
let r = (hash & 0xFF0000) >> 16;
|
| 185 |
+
let g = (hash & 0x00FF00) >> 8;
|
| 186 |
+
let b = hash & 0x0000FF;
|
| 187 |
+
|
| 188 |
+
// Convert RGB values to a CSS color string
|
| 189 |
+
return `rgb(${r}, ${g}, ${b}, 1)`;
|
| 190 |
}
|
| 191 |
|
| 192 |
|