lemur color
lemur color
Hi!
What is the formula to convert a lemur color value (color="65793") to the RGB values?
I'm not asking so I can do this in Lemur script, but for an JZML to Canvas object code conversion program that I have written.
Jay
What is the formula to convert a lemur color value (color="65793") to the RGB values?
I'm not asking so I can do this in Lemur script, but for an JZML to Canvas object code conversion program that I have written.
Jay
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
-
- Regular
- Posts: 294
- Joined: 24 Jan 2012 18:22
Re: lemur color
Not sure but wasnt the colorpicker in the Lemur Modules Forum doing the conversion?
https://forum.liine.net/viewtopic.php?p=13248#p13248
https://forum.liine.net/viewtopic.php?p=13248#p13248
Re: lemur color
While the colorpicker in that template is neat (and I have seen that thread), I need to do the opposite.
Again not using Lemur scripting, but another language PERL.
Even without the colors being translated to the canvas RGB, the program does create working Lemur canvas_ script which can save days of scripting work in Lemur.
It turns all switches and pads (even multicolumn) into hit regions so on_cursor scripting is much less.. painful. Also draws the regions.
One could do page layout in the editor, run the canvas convertor, then copy the output to another template as code... without being an expert in canvas_ scripting. Still it is basic, no fancy arcs and curves yet.
Jay
Again not using Lemur scripting, but another language PERL.
Even without the colors being translated to the canvas RGB, the program does create working Lemur canvas_ script which can save days of scripting work in Lemur.
It turns all switches and pads (even multicolumn) into hit regions so on_cursor scripting is much less.. painful. Also draws the regions.
One could do page layout in the editor, run the canvas convertor, then copy the output to another template as code... without being an expert in canvas_ scripting. Still it is basic, no fancy arcs and curves yet.
Jay
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Re: lemur color
Hi
You need to reverse the colour formula mentioned in the manual
I recall doing it at some time, not sure if it is posted here or somewhere on my drive
Will try to find it or redo it,
Cheers
You need to reverse the colour formula mentioned in the manual
I recall doing it at some time, not sure if it is posted here or somewhere on my drive
Will try to find it or redo it,
Cheers
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: lemur color
Yeah
Here you go - try this as a one-liner . . .
asRGB(colour) = {( color >> 16 ) & 0xFF,( color >> 8 ) & 0xFF,color & 0xFF}/127 // returns 0...1 values
As 7 bit 0 - 127 values
asRGB_7(colour) = {( color >> 16 ) & 0xFF,( color >> 8 ) & 0xFF,color & 0xFF}
And to reverse . . .
asColor_7(r,g,b) = (r << 16) + (g << 8) + b
Cheers
MM
Edit: first version was for returning 7 bit values, fixed now for asRGB(colour) to return 0....1 values
Here you go - try this as a one-liner . . .
asRGB(colour) = {( color >> 16 ) & 0xFF,( color >> 8 ) & 0xFF,color & 0xFF}/127 // returns 0...1 values
As 7 bit 0 - 127 values
asRGB_7(colour) = {( color >> 16 ) & 0xFF,( color >> 8 ) & 0xFF,color & 0xFF}
And to reverse . . .
asColor_7(r,g,b) = (r << 16) + (g << 8) + b
Cheers
MM
Edit: first version was for returning 7 bit values, fixed now for asRGB(colour) to return 0....1 values
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: lemur color
Hi Macciza! That is fantastic, thank you for the code. I integrated the formula into the converter program without issue.
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Re: lemur color
No worries
Are you looking at posting the code at all?
Cheers
MM
Are you looking at posting the code at all?
Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: lemur color
Yes I'll be posting the code and perhaps a little intro on how to use it.
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Re: lemur color
and.. I am pleased to report that it works and will produce a working JZLIB (or only raw script code).
Still have some fine tuning to go before posting it, but the savings in time for creating cursor hit regions out of a multi-row switch or pad is amazing. It can optionally turn objects into an array of circles and rounded rectangles, also with hit regions.
If one of you guys are comfortable running Perl on the command line, let me know (PM me) and you can try it out.
I test it in OS X terminal, but it will run within any other unix shell or possibly Windows with Perl installed.
Still have some fine tuning to go before posting it, but the savings in time for creating cursor hit regions out of a multi-row switch or pad is amazing. It can optionally turn objects into an array of circles and rounded rectangles, also with hit regions.
If one of you guys are comfortable running Perl on the command line, let me know (PM me) and you can try it out.
I test it in OS X terminal, but it will run within any other unix shell or possibly Windows with Perl installed.
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas