Open E-A-N opened 6 years ago
Hmmm apparently there's already a colorMixing.js. It's a self evoking function that returns an object of helper functions :thinking:
Who ever takes on this task will probably just have to convert this file over our pattern usage.
ColorMixing was my initial take. I will need to review it again, but not sure if I can finish this in time. Monday is my soft deadline, back to the grind... 😟
@hal255 no worries, we'll get it done. I can do it, or have someone else do it.
So I wanted to share some research I did on color mixing, even though it wasn't really necessary to go this far :P
The standard color mixing done by computers in the RGB style is called additive mixing, as adding all three colors together will eventually produce white. This is because all the frequencies of the colored lights combine. In this mixing scheme, red, green, and blue are the primary colors.
The painter's color mixing is called subtractive mixing, and its primary colors are cyan, magenta, and yellow. With subtractive mixing, adding all three primary colors will produce black. This is because adding more differently-colored "paint" together absorbs more incoming light frequencies, allowing less frequencies of light to bounce back to the eye.
Now, the mixing scheme we seem to be using here has primary colors of red, yellow, and blue, according to #98. In an additive mixing scheme, mixing yellow and blue actually produces grey, not green, so this mixing scheme must be subtractive. However, the subtractive scheme's primary colors are cyan, magenta, and yellow, and the reason why red-yellow-blue caught on is literally because red is close to magenta, and blue is close to cyan, and that ended up being easier to teach in elementary school. It just so happens that red+yellow=orange and red+blue=purple coincidentally follow the additive mixing scheme.
So for this mixing algorithm (PR #105), I'll take advantage of that coincidence, but I added a special, hard-coded case for yellow+blue to produce green rather than grey.
colorSystem.js
or something along those lines (this is not a gameState, so it's default)