Is there an algorithm for color mixing that works like mixing real colors?

前端 未结 7 846
野的像风
野的像风 2020-11-28 18:38

The common mixing of RGB colors is very different from mixing colors for paintings, it\'s mixing of light instead mixing of pigments.

For example:

Bl         


        
7条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 19:31

    Wondering if calculation of inversion of the RGB value work. Since it's about subtraction of lights, technically the subtraction part can be calculated by simple math.

    For example cyan + yellow

    cyan = 0x00ffff yellow = 0xffff00

    Their inversions are 0xff0000 and 0x0000ff, meaning they absorbed red and blue lights completely. Their 1:1 mixture should absorb half of red and blue lights (since the other half of the mixture can still reflects some red and blue light), which is consistent with (0xff0000 + 0x00ffff) / 2 = 0x7f007f. Now we subtract the value from 0xffffff we have 0x80ff80 which is green!

提交回复
热议问题