AathifMahir / MauiIcons

MauiIcons is Icon Collection Library for .Net Maui
MIT License
197 stars 13 forks source link

Allow Icon Tinting by passing a Tint to the fluent binding #32

Closed edgiardina closed 1 year ago

edgiardina commented 1 year ago

Is your feature request related to a problem? Please describe. At the moment, Android does not honor the Shell colors when it comes to Toolbar icons. Because of this, I normally have to maintain and tint my SVG icons by hand in order for them to show up right in the toolbar on Android https://github.com/dotnet/maui/issues/9240

Describe the solution you'd like I would love to be able to provide to the fluent:Icon binding source a Tint property. This way I could declare my ToolbarIcons using a MauiIcons source instead of a standard image source and be able to tint at runtime. This would avoid maintaining multiple sets of icons, and allow further theming and customization at runtime.

<Image Aspect="Center" Source="{fluent:Icon Icon=ActionCenterQuiet, Tint={StaticResource MyColor}"/>
<ToolbarItem Text="Share" x:Name="ShareButton" Clicked="ShareButton_Clicked" 
    IconImageSource="{fluent:Icon Icon=ActionCenterQuiet, Tint={StaticResource MyColor}" />

It would also be nice if the tint could take an AppThemeBinding {AppThemeBinding Light={StaticResource PrimaryTextColor}, Dark={StaticResource PrimaryTextColorDark}} So that I could tint differently depending on Dark Mode / Theme.

AathifMahir commented 1 year ago

@edgiardina Will implement this as soon as possible

AathifMahir commented 1 year ago

@edgiardina Can you please provide a simple sample based on this scenario, as far as my testing i don't have any issues on showing icons with color on android with MauiIcons in Toolbar

image

edgiardina commented 1 year ago

There's already an IconColor?! I mean, I think that means MauiIcons already supports what I want to do. Thank you!!!!!

AathifMahir commented 1 year ago

There's already an IconColor?! I mean, I think that means MauiIcons already supports what I want to do. Thank you!!!!!

Thanks for confirmation, will close this issue and also by the way feel free to drop a proposal if you'd like to replace IconColor Property with Tint or IconTint, we could discuss and regarding this breaking change and could push it with next major release.