I wrote a function that converts a musical note into a hexadecimal color value.
const colorFromNote = note => `0x${note}${note}${note}`
For example, when 'C4' is passed in, the function returns 0xc4c4c4
. Unfortunately, this approach doesn't work with Three.js since it requires an actual hexadecimal parameter, not just a string representation.
Existing solutions focus on generating hex codes from color names, but I specifically need to convert a string of a hex code into the hexadecimal value itself.