I'm trying to simulate mix-blend-mode:exclusion
blending mode with only SVG filters. The docs say exclusion is a substraction of darker color from lighter, in other words, greater color component value minus smaller color component value.
Is there any way to simulate this logic using SVG filters?
The original image is:
The filtered image would be:
The color to exclude is #3a0339
I'm bringing some code snippets for your convenience:
svg {
width: 0;
height: 0;
}
.myFilter {
filter: url(#myFilter);
}
<svg>
<defs>
<filter id="myFilter" x="0" y="0" width="100%" height="100%">
<feFlood result="fill" flood-color="#3a0339" flood-opacity="1">
</feFlood>
<feComposite operator="arithmetic" in="SourceGraphic" in2="fill" k1="0" k2="0.5" k3="0.5" k4="0"/>
</filter>
</defs>
</svg>
<img class="myFilter" src="https://i.sstatic.net/ux2FT.png">
feComposite
, but that also subtracts the alphas, so they cancel out (ie. 1-1=0). Leaving you with an invisible result.