Lowering a decimal RGB (hex) value
Nov 03 2015 | 9:28 pm
I have a decimal number which represents an RGB value and I want to lower the value in order to darken the color. To that end I convert the decimal value to hex, I split it up in 3 parts which I then individually convert back to a decimal value, I subtract the number I need and then I convert them back to their hex counterpart.
My problem starts when I try to join all 3 parts back together (using 'join 3') in order to recreate the complete hex value again: I end up with "BC BC BC" instead of "BCBCBC" which is what I need so that I can create the right decimal value.
I read about 'tosymbol' and how it should be able to remove the spaces from a list if you use the message separator without arguments (so 'tosymbol @') but that doesn't work for me, the spaces in my symbol remain.
Is there a better or maybe easier way to accomplish this? I already tried checking up on jitter because I assume that it might have something to perform RGB type calculations but so far I've found nothing.
This is the patch I'm working on, and thanks in advance for any comments!