muak / SvgImageSource

Custom ImageSource that will become able to show svg image for Xamarin.Forms
MIT License
62 stars 11 forks source link

Please add support to iOS darkmode #11

Open machocr opened 4 years ago

machocr commented 4 years ago

Hi, I'm using styles to set svg colors: <svg:SvgImageSource Source="Images.Icons.circle.svg" Width="30" Height="30" Color="{DynamicResource AccentColor}" /> That allows me to use a different color when the theme changes because of dark mode being activated or deactivated. While this work fine if I close and open the app, it doesn't work if I don't abandon the app (if I change the dark mode without exiting and en entering again).
So what we need is to refresh the svg color when theme changes. I'm going to play try the code and see if I'm able to make this happen.

candidodmv commented 4 years ago

Hello @machocr! You can easily achieve that providing a new Source or try raise a faking change event on the "dark mode is applied" or include color property in this condition line: https://github.com/muak/SvgImageSource/blob/922a0dbbbf0b175d6a5ee5766d2891ebb5b93fdf/SvgImageSource/SvgImageSource.cs#L313