Page 1 of 1

Colors (in modules) Question

Posted: Tue Sep 13, 2016 4:31 am
by orion
Hey folks I have a question about a module I'm working on for a show i have coming up.
I've made a quick color selector module that allows me, with one click, to select a preset color. I can select which color gets adjusted (modulate, additive, background color, invert color, output add color) but I just grabbed the colors from an existing module.

they look like this in the editor

module.paintRect('white',0,0,25,25,1,1,1,1);module.finishDrawings('white')
module.paintRect('red',0,0,25,25,1,0,0,1);module.finishDrawings('red')
module.paintRect('green',0,0,25,25,0,1,0,1);module.finishDrawings('green')

I have four other colors I'm trying to add, I need to use a specific color for different songs. I have the RGB values of the colors I'm trying to add, for example (255,153,153) are the RGB colors for a pink I'd like to use.

My question, how do I use those RGB colors to edit the values in module.paintRect accordingly? I have 3 RGB values but there are 8 values in module.paintRect. Can someone guide me in how to translate the RGB values for said module? Or does anyone have a suggestion on how to make a color palette selector module near what I'm trying to do? Is there a better way to do this?

Any help is appreciated.
Thanks
Orión

Re: Colors (in modules) Question

Posted: Tue Sep 13, 2016 5:01 am
by orion
oops nevermind, figured it out.
you gotta do some math since rgb values range from 0-255 and module colors range from 0-1.

Say for example the pink I was trying get ie 255,153,153

I just had to change this
module.paintRect('red',0,0,25,25,1,0,0,1);module.finishDrawings('red')

to

module.paintRect('red',0,0,25,25,1,.59,.59,1);module.finishDrawings('red')

The first '1' is R, followed by G,B and alpha it looks like.

Once the draw view color is changed you're gonna want to change the color.
That would be, in this case, in the editor under script connect > send message. Change red (1,0,0) to pink (1,.59,.59)

Wündervag! I just had to ask the question out loud I guess :))