Is it possible to accept a value input from the user and set colour to an onscreen object based on this value?

Jan 06, 2021

Looking to set the colour of an onscreen object based on the input from the user. I am sure I have seen a similar example somewhere on this site where the user could set the RGB values via dials/sliders and have the combination RGB colour reflect on a screen object. Please help. 

Thanks in advance!

3 Replies
Judy Nollet

Hi, Lakshmi,

Yes, it's possible to change the state of an object based on user input. To do that, you need to use variables and conditions. The more variations you want to offer, the more variables and triggers (with conditions) you'll need. 

The User Guide provides more information:

Lekshmi Nair

Hi Judy

Thanks a lot for the guide links. Still in the process of learning the various options.

I would like to get some specific information on how to set the colour of screen objects to a certain RGB value through Javascript perhaps. I think States may not really do the trick since the final RGB value will be a combination of 3 different inputs from the user. There has to be a function that will take the values as input and generate the final RGB colour as output and then some line of code that will fill the onscreen object with this RGB colour.

Thanks again,

L.V