# RGB functions

Question asked by art on Jun 29, 2012
Latest reply on Jun 30, 2012 by art

Hi all,

My situation is: I want to program a battery bar chart. ie basic rectangle say 2cm wide and 6cm long (basic estimate). I have already used the inspector to draw the outline!

I want to show 2 basic colours ie. green and red - Green for a positive score and red for negative score! I already have the score pre-determined from a previous calculation. In tis case I have 96% positive and 4% negative!

I want to show the colour of this bar or 'battery' as I call it with a RGB value of green - 96% and the remaining 4% = red!

Is there a way to say eg. colour or RGB the rectangle with a 96% green and the remaining 4% of the remaining area = red?

The 96% and 4% could vary but not important at this stage. I'm just wanting to know the correct syntax to do this. Was thinking along the lines of maybe (plain english ....) something like RGB (co-ordinates of the rectangle...?) value =green and RGB(co-ordinates remainder) value = red ...?

Any suggestions would be appreciated!

Appreciated!

Art