Manually Entering Color Values (RGB,ect)

Discuss problems and solutions.
Emerson
Newbie
Posts: 15
Joined: 08 Jul 2014 16:00

Manually Entering Color Values (RGB,ect)

Post by Emerson »

I am trying to create a template which contains various colored objects that correspond to the same colored items and tracks in my DAW. This is for easy visual representation. For the sake of consistency (there are often several shades of the same color), I would like to be able to simply enter the RGB or HSV color values. Exploring the forums, I realize several people have expressed wanting the option to do this within the color picker menu but it is not currently possible. Hopefully that will be implemented in a future update.

So...from what I understand (I'm a newbie), there is a way of doing this by scripting. However, after lots of searching and experimenting, I just cannot figure out how to get the RGB(r,g,b) function to work in my template. I am realizing I learn a lot more from just seeing an example of what DOES work than spending hours finding out what doesn't.

All I am trying to do is make a single pad a specific color. For example, an RGB value of 191,15,248.

If someone could please share with me an example of how to do this or point me in the right direction, it would be greatly appreciated!
Joe Soap
Regular
Posts: 462
Joined: 07 Jul 2012 15:04

Re: Manually Entering Color Values (RGB,ect)

Post by Joe Soap »

setattribute(Pads, 'color', { RGB (191, 15, 248) } );

. . . is the direct syntax, where 'Pads' is the object to be addressed - you can execute this 'on load' in a script to initialise the colour of the object when the template ummm . . . loads.
Emerson
Newbie
Posts: 15
Joined: 08 Jul 2014 16:00

Re: Manually Entering Color Values (RGB,ect)

Post by Emerson »

Thanks Joe! After a bit more research, I finally did figure out how to manually change the colors of objects using the "setattribute" functions. Pretty basic I know...but I'm new to this :)

So...thats great BUT the numbers I input for the RGB values do not correspond to the colors I'd like them to be. For example, say I want a nice purple color that I have determined (with the help of an online color reference tool) has an R,G,B value of 135, 4, 251. When I enter the script for a Pad:

setattribute(Pads, 'color', RGB(135,4,251));
OR
setattribute(Pads, 'color', 1123776645); (*number derived using the calculation ((R x 2^16) + (G x 2^8) + B) from the manual)

I get a sort of grey. Does that mean the color spectrum in Lemur is different than that of "standard" color codes used in Photoshop for example? Basically, is there any way to represent the exact color from something OUTSIDE of Lemur? I thought since I knew the "true" RGB values, it would be easy to just input them in Lemur but maybe its a little more complex. Of course, I could do this all by eye but I have a LOT of colors and shades to match and it would be awesome to maintain consistency.

Fyi, this is what I was using to derive the color values: http://html-color-codes.info/colors-from-image/
Joe Soap
Regular
Posts: 462
Joined: 07 Jul 2012 15:04

Re: Manually Entering Color Values (RGB,ect)

Post by Joe Soap »

When I use the values you provide, I get a purple. I'm pretty sure you haven't derived the correct value using the formula from the manual in your second example - but that's not really germane to the problem, you don't need that to set the RGB (only to derive RGB from the packed value Lemur uses for storage - 'get', as opposed to 'set').

I can't think of a good reason why you're getting grey, except maybe the 'light' field in the Pads object Properties (Editor) is set to something screwy or something like that? But even that ought not to produce grey with those RGB vals.

Is it just a single pad, or a pads object with multiple rows / columns (pads)?
Emerson
Newbie
Posts: 15
Joined: 08 Jul 2014 16:00

Re: Manually Entering Color Values (RGB,ect)

Post by Emerson »

Thanks for your help Joe! Thats very strange indeed...I am sure I'm doing something wrong on my end then but I don't know what!

I've uploaded a simple .jzml example of how I am "trying" to go about it if you'd like to take a look. I think my light properties are all good as I haven't touched them and they are all set to zero. I am trying to change the color of just a single pad (though I'd be interested in how to do the same thing for pad objects with multiple rows/colums). I just hope I'm not suddenly going color blind :)
Attachments
RGB Test.jzml
(4.92 KiB) Downloaded 120 times
Joe Soap
Regular
Posts: 462
Joined: 07 Jul 2012 15:04

Re: Manually Entering Color Values (RGB,ect)

Post by Joe Soap »

Dammit man, you're right!

And - I'm afraif I gave you a bit of a bum steer earlier - the values for RGB should be between one and zero. Also, the {} curly-brackets aren't necessary - they're for use on a vector / array.

So . . ., correct syntax this time:

setattribute(Pads, 'color', RGB ( 0.n, 0.n, 0.n) );

(1, 0, 0) == Red
(0, 1, 0) == Green
blah blah

The conversion I'll leave to you.

Sorry about the earlier misleading info - multitasking sucks y'all.
Emerson
Newbie
Posts: 15
Joined: 08 Jul 2014 16:00

Re: Manually Entering Color Values (RGB,ect)

Post by Emerson »

Thanks again Joe (for your help and confirming that I'm not going crazy)! You have saved me many headaches!

Fyi, I think I have figured out the conversion I need. From what I can tell, standard html RGB values go from 0-255 and, as you pointed out, Lemur requires a value from 0-1.

So, 1/255=0.003921568627451 (which gives us the interval value between 0 and 1). Now, I simply multiply whatever my RGB values are by that number. (i.e. 135 x 0.003921568627451). So far, It seems to work!

Going further, I am curious if there is a way for lemur to do that conversion for me...so that I can still just input the "real life" RGB values (like 135,4,251) and have Lemur multiply each by 0.003921568627451. Is that possible? It seems like it "might" be using one of the math functions but I'm not exactly sure where to start due to my limited experience with scripting...

I only ask because I have a LOT of colors to enter and I think this could be useful to others looking to do the same. It would be AWESOME if choosing RGB values via the color pallet would be implemented in a future update.
Emerson
Newbie
Posts: 15
Joined: 08 Jul 2014 16:00

Re: Manually Entering Color Values (RGB,ect)

Post by Emerson »

Ok...so I just tried the obvious (duh!) and it works great!

setattribute(Pads, 'color', RGB ( 198*0.003921568627451, 14*0.003921568627451, 244*0.003921568627451) );
Joe Soap
Regular
Posts: 462
Joined: 07 Jul 2012 15:04

Re: Manually Entering Color Values (RGB,ect)

Post by Joe Soap »

Here's a basic module with an easier way to derive the direct colour values:
Colour_Conversion.jzlib
(10.24 KiB) Downloaded 200 times
[edit]

Damn it - sorry, DL again, fixed initialisation stuff.
Last edited by Joe Soap on 16 Aug 2014 00:25, edited 1 time in total.
Emerson
Newbie
Posts: 15
Joined: 08 Jul 2014 16:00

Re: Manually Entering Color Values (RGB,ect)

Post by Emerson »

Nice! Thanks Joe!
Post Reply