Forums > Jitter

HEX to RGB?

May 26, 2010 | 2:55 am

So I’m back with a related question to my last post, thanks to your help I managed to extract the HEX values of colour swatches from the Kuler API rss feed, but now I need to convert it to rgb if I want to use this in my work… any thoughts? I thought for sure jitter or Max would have an object for that, but if it has I haven’t found it yet… I’m sure I could create a little module to do the conversion manually, but sadly I learned Hex code a long time ago in my intro to music programming course, and I don’t really remember that part of the course so well, plus I’m sure there’s an easier way out there ;)

P


May 26, 2010 | 5:18 pm

there is no object for this. like most things in max, there are several ways to achieve this with existing objects. javascript might be the cleanest solution.

here is one that uses regexp to split up each of the hex characters, zl slice to group them into rgb, route to determine if it’s an int or letter, atoi to convert letters to numbers, and simple math to do the rest.

– Pasted Max Patch, click to expand. –

May 28, 2010 | 2:03 am

Thanks, this as proved very useful! its good to know we can always turn to the max community for help.


Viewing 3 posts - 1 through 3 (of 3 total)