Adding Colours (Colors) Together like Paint (Blue + Yellow = Green, etc)

Posted by glenstorey on Stack Overflow See other posts from Stack Overflow or by glenstorey
Published on 2012-04-13T11:17:54Z Indexed on 2012/04/13 11:28 UTC
Read the original article Hit count: 260

Filed under:
|
|
|
|

I'm making an iOS game using cocos2d libraries.

Lets say you have two objects that have two separate colours - defined in RGB as

Blue:    0,0,255
Yellow:  255,255,0

I want to add blue and yellow to make green.

To over complicate things, let's say that the Blue object is bigger than the Yellow object (for the sake of argument let's say that the ratio is 2:1), I'm adding twice as much blue as yellow - how to I calculate this new (light green) colour correctly.

I understand LAB * Color Space is useful for this sort of 'natural colour' kind of thing, but I'm not sure how to use it - especially in the context of a cocos2d object which (AFAIK) is limited to using RGB in its colour schemes.

I'd really appreciate practical help on how to implement this. Thanks heaps!

© Stack Overflow or respective owner

Related posts about c++

Related posts about objective-c