Open
Description
We should have a method for alpha blending. This is required to be able to do contrast calculations properly (see w3c/csswg-drafts#7358 ).
Things to decide:
- Naming: Perhaps
overlay()
orover()
? OroverlayOn()
or juston()
which is more clear as aColor
method, but not so much in the procedural API (SeeoverlayOn(color1, color2)
vscolor1.overlayOn(color2)
). Whatever we come up with should make sense in both APIs, so I’m leaning towardover()
which is also the operator name. - Is there any reason for it to take more than 2 arguments? My understanding is that the operator is associative.
The math seems pretty straightforward. @svgeesus are there any considerations when applying this to other color spaces? What color space do we use for the result? I guess the color space of the color being overlaid?