How I can invert programmatically the color of an image in flutter? I want to invert the full color of the image not only the background.
If you want to change the background color dynamically you will first have to make the background transparent by adding an alpha channel mask to the image (again using an image editor) You will then be able to define a background color by putting the image inside a widget that has a background color.
now it's possible using the ColorFiltered
widget.
https://api.flutter.dev/flutter/dart-ui/ColorFilter-class.html
You find a detailed explanation on my blog https://www.burkharts.net/apps/blog/over-the-rainbow-colour-filters/
Currently it's not possible to invert colors with out of the box solutions. You can try to use ShaderMask as suggested in this answer. You may also check out BlendMode options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With