absqueued
absqueued

Reputation: 3063

How to Invert a White image to Black using SVG Filters?

Is there a way to invert a white image to black using SVG filters?

In CSS Filter, we do -webkit-filter:invert(1); which does not work in IE10. I am applying SVG filters as fallback. Any one can help?

Upvotes: 12

Views: 20195

Answers (1)

Michael Mullany
Michael Mullany

Reputation: 31715

You can invert using an SVG Filter:

<feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 
                                                              0 -1 0 0 1 
                                                              0 0 -1 0 1
                                                              0 0 0 1 0"/>

For more detail see the docs on feColorMatrix at MDN

Upvotes: 16

Related Questions