I need to accomplish the color "blending" shown in the image -- for areas where there are 2 shapes overlapping it needs to display as a particular color (orange here), and a separate color for 3 overlap (red here).
I need something very dynamic and easy to extend to more overlapping shapes. There may be up to 20 shapes that overlap in various areas. Shapes are random, with no predictable form.
I am drawing the shapes as SVG polygons using D3js.
I have tried the css mix-blend-mode but it is not useful for my needs. I have been researching this for two days with no luck...
if
mix-blend-mode
is not useful for your needs ( maybe you don't like the colors or you didn't appliedisolation: isolate;
to the group ) you may try usingclipPath
.Since you don't publish your code I can't work on your example. The code that comes next may give you some ideas.
The example above is heavily inspired by "clipping a clipPath" from Using SVG with CSS3 and HTML5: Vector Graphics for Web Design