As far as I understand, CSS' mix-blend-mode
is supposed to behave the same way as Photoshop' Blend mode. However, in the following simple example I am getting different results and I am not sure why.
Example
A cyan rectangle (#00ffff) half overlapping a red rectangle (#ff0000). The blend mode of the cyan rectangle is set to "darken". Because "darken" picks the darkest of each channel (RGB) for the overlapping pixels, and all three channels are 0 in at least one of the two rectangles, I would expect the overlapping area to be black.
Result in Photoshop
(cyan rectangle outlined for clarity)
- The cyan rectangle is not visible on the black background (expected)
- The overlapping area is also black (expected)
Result on web (Latest Chrome, 70.0.3538.102)
- The cyan rectangle is visible on the black background (not expected)
- The overlapping area is dark (#2d0c1b), but not black (not expected)
Live example: CodePen
So... why is the result not the same? What am I missing?
The result is the same but the black background is applied to the
body
and not the to parent of the element where you applied themix-blend-mode
.Moving the black background there will fix the issue: