Converting RGB values to Hexadecimal?
kindofblue272
5月 25 2011 | 10:20 午後
I am working on a patch to control a string of RGB LEDs via music input. Currently I have been able to use a filter bank to generate R G B values (either on a scale of 0 to 255 or 0 to 1.0) from a color look-up table. I am having trouble figuring out how to convert these values to hex format for output to the LEDs though. I have found several javascript examples, but haven't been able to get them to work within a Max patch, anybody know how to do this?
cap10subtext
5月 26 2011 | 2:21 午前
You can use the Lhex object along with the regexp in the patch below:
williamjturkel
6月 26 2012 | 1:45 午後
I wanted to be able to do this without installing any externals. An alternative is to feed number boxes into [sprintf]. To get HTML color codes, for example, use
sprintf #%x%x%x
Liam Joy Niemeijer
7月 23 2024 | 11:21 午前
if you use sprintf %02x%02x%02x you consistently get 8 numbers