Skip to main content
Known Participant
June 21, 2011
Answered

colour mixture

  • June 21, 2011
  • 1 reply
  • 1794 views

Hey there,

I just created an application in flash with the topic colour harmonies. You are able to pick

three colours from a colour wheel. Those colours are transformed into a scaleable grid in the

arrangement colour 1, colour 2, colour 3, colour 1, colour 2, colour 3,.....

If you scale down the grid to pixel squares you can see the mixed colour (usually it should

be displayed grey then because of the color harmonie law). Now I want to compare this

process to a computer generated colour out of those three basis colours...

So is it possible to mix the three colours and transform the resulting mixture colour (usually

grey again) into a new colour field? Or is there any function that does the same?

Thanks a lot!

_snickers

This topic has been closed for replies.
Correct answer kglad

perfect thanks a lot i will try to get this working with my code...this is also possible with a third colour (var a3) isn't it?


you can use any number of colors.  just average their component colors and composite them as shown above.

p.s.  please mark helpful/correct responses, if there are any.

1 reply

kglad
Community Expert
Community Expert
June 21, 2011

if you're not incorporating transparency, you can add rgb values (not to exceed 0ff) or you can average rgb values and there are probably other mixing models that you might want to use.

most likely, averaging the rgb values is what you want.  i think that would work well with pointilism and that seems to be what you're doing.

TSIXDAuthor
Known Participant
June 21, 2011

i thaught of the same idea of using the average values of the rgb. is there any function? cause i don't really know how to do that in code

well, i don't need to do this in my "pixel grid"...i only want to create a field that shows the mixed colour...

you have three 50x50 pixel squares filled with three different colours...and in a fourth field those colours should be mixed to a new colour (grey) out of those three ones...do you understand what i'm talking about?

kglad
Community Expert
Community Expert
June 21, 2011

if you want to average colors:

function colorAverageF(c1:uint,c2:uint):uint{

var a1:Array=rgbF(c1);

var a2:Array=rgbF(c2);

return (a1[0]+a2[0])/2 << 16 | (a1[1]+a2[1])/2 << 8 | (a1[2]+a2[2])/2;

}

function rgbF(c:uint):Array{

return [c>>16,c>>8&0xff,c&0xff];

}