maui-theming

Implement light and dark theme support in .NET MAUI apps.

Updated Nov 27, 2025
One-click install
npx skills add https://github.com/seydakaratekeli/KamPay3 --skill maui-theming-seydakaratekeli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: maui-theming
Source: https://github.com/seydakaratekeli/KamPay3/tree/main/KamPay/.github/skills/maui-theming%20-%20Kopyala
Command: npx skills add https://github.com/seydakaratekeli/KamPay3 --skill maui-theming-seydakaratekeli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides clear guidance and practical patterns for implementing reliable light and dark theme support in .NET MAUI applications, preventing state loss, inconsistent colors, and runtime update issues when the system theme changes or when the user selects a custom theme.

Core Features & Use Cases

  • AppThemeBinding for OS-driven themes: use AppThemeBinding to automatically adapt UI values to system light or dark mode with minimal code.
  • ResourceDictionary swapping for custom themes: define separate ResourceDictionary theme files and swap them at runtime to support branded themes or more than two themes, ensuring UI updates by using DynamicResource.
  • Runtime APIs and gotchas: read the current theme via Application.Current.RequestedTheme, force or reset via Application.Current.UserAppTheme, respond to RequestedThemeChanged events, and use SetAppThemeColor helpers; on Android ensure MainActivity includes ConfigChanges.UiMode to receive theme change events; note that CSS-based themes cannot be swapped at runtime.

Quick Start

Enable Android UiMode in MainActivity, prefer AppThemeBinding for automatic OS support, and implement ResourceDictionary swapping with DynamicResource to achieve runtime theme switching.

Frequently Asked Questions about maui-theming

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement light and dark mode theming in .NET MAUI apps?

Implement .NET MAUI light and dark mode theming by using AppThemeBinding for automatic OS-driven theme adaptation or swapping ResourceDictionary files at runtime with DynamicResource for custom branded themes beyond standard light and dark modes.

How does AppThemeBinding work for OS-driven theme detection in .NET MAUI?

AppThemeBinding in .NET MAUI automatically adapts UI values to system light or dark mode with minimal code, reading the OS theme and applying corresponding values without manual event handling or runtime resource swapping.

Why are my .NET MAUI dark mode colors not updating at runtime on Android?

Runtime theme updates on Android require adding ConfigChanges.UiMode to MainActivity to receive theme change events. Additionally, use DynamicResource markup instead of StaticResource so the UI updates when ResourceDictionary values are swapped at runtime.

Can I swap ResourceDictionary files at runtime to support custom branded themes in .NET MAUI?

Yes, define separate ResourceDictionary theme files and swap them at runtime to support branded themes or more than two themes. Ensure UI updates by using DynamicResource markup so changes propagate automatically when the dictionary is replaced.

How do I force or reset the application theme using Application.Current.UserAppTheme in .NET MAUI?

Read the current theme via Application.Current.RequestedTheme, then force or reset it by setting Application.Current.UserAppTheme. Respond to RequestedThemeChanged events and use SetAppThemeColor helpers to manage developer-driven theme overrides.

What are the limitations of CSS-based themes for runtime switching in .NET MAUI?

CSS-based themes in .NET MAUI cannot be swapped at runtime. For runtime theme switching, use AppThemeBinding for OS-driven themes or ResourceDictionary swapping with DynamicResource to support custom branded themes and dynamic updates.