I'm trying to implement poor-man's blending modes for CSS, in anticipation of browsers rolling out support. (The CSS preprocessor I'm using is Stylus, which isn't important to the discussion.) I've found a source for blending mode calculations from the W3C SVG spec, but some of the equations give wildly different results from what's expected - specifically, hard-light
, soft-light
, color-dodge
, and color-burn
.
Does anyone know of more correct, reliable formulae for the blending modes in question? I'm premultiplying the RGB channels of each colour by their alpha.
Here's what I've got so far. https://github.com/pdaoust/stylus-helpers/blob/master/blend.styl