Change the app icon based on the light/dark mode

Enrico Rossini 236 Reputation points
2025-08-20T06:15:40.3066667+00:00

In a .NET 9 MAUI application, I would like to change the app icon based on light or dark mode, based on the system.

The icon of the application is an SVG image with a transparent background.

Is there any example of documentation how to implement it?

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Gade Harika (INFOSYS LIMITED) 2,415 Reputation points Microsoft External Staff
    2025-08-21T11:24:37.1033333+00:00

    Thank you for sharing the details, here’s is the Step-by-Step Guide.
    switching app icons based on system theme is a great way to enhance the user experience, and MAUI gives you a few options depending on the platform.

    iOS & Mac Catalyst

    iOS supports alternate app icons, which you can switch at runtime. You’ll need to:

    Add alternate icons to your asset catalog (e.g., AppIconLight, AppIconDark)

    Define them in your Info.plist under CFBundleAlternateIcons

    Use UIApplication.SharedApplication.SetAlternateIconName(...) to switch icons based on the current theme

    This works while the app is running, but note that iOS won’t auto-switch icons when the system theme changes unless your app is open.

    Android

    Android doesn’t support dynamic icon switching in the same way, but you can:

    Use a monochrome icon layer (Android 13+) that adapts to light/dark mode automatically

    • Or use activity aliases with different icons and enable/disable them at runtime (more complex)

    SVG Support

    Since your icon is an SVG, you’ll need to export it as PNGs for platform compatibility. MAUI doesn’t support SVGs directly for app icons, but you can use them within your app UI using libraries like SkiaSharp.

    Let me know if the issue persists after following these steps. I’ll be happy to assist further if needed. If the issue has been resolved, kindly mark the response as answered.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.