maui-theming
What it does
This skill guides theming in .NET MAUI apps, including light and dark mode and custom colour themes. It is for developers who want their app to follow the system theme or let users choose.
When to use it
- βWhen you want a .NET MAUI app to support light and dark mode.
- βWhen you want to switch themes at runtime or let users pick one.
- βWhen you want a branded colour theme set up with resource dictionaries.
Skill link
https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-theming/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βAdd dark mode to my MAUI app and let users choose light, dark or system theme in settings.β
5 new skills a week. 1 minute to read.
How it works
The agent uses theme bindings for simple light and dark colours, or swaps resource dictionaries for custom themes, and responds to the system theme and the user's choice.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
.NET MAUI Theming
Apply light/dark mode support, custom branded themes, and runtime theme switching in .NET MAUI apps using AppThemeBinding, ResourceDictionary swapping, and system theme detection APIs.
When to Use
- Adding light and dark mode support to a .NET MAUI app
- Creating custom branded themes with ResourceDictionary
- Detecting and responding to system theme changes at runtime
- Letting users choose a preferred theme (light, dark, or system default)
- Combining OS-driven theme response with custom color palettes
When Not to Use
- Localization or language switching β see .NET MAUI localization docs
- Accessibility-specific visual adjustments β see .NET MAUI accessibility docs
- App icon or splash screen configuration β see .NET MAUI app icon docs
- Bootstrap-style class theming β see the
Plugin.Maui.BootstrapThemeNuGet package
Inputs
- A .NET MAUI project targeting .NET 8 or later
- XAML pages or C# UI code that need theme-aware styling
Workflow
- Detect the current theme approach in the project (AppThemeBinding, ResourceDictionary, or none).
- Choose the appropriate strategy: AppThemeBinding for simple light/dark, ResourceDictionary swap for custom/multiple themes, or both combined.
- Define theme resources β inline
AppThemeBindingvalues or separateResourceDictionaryfiles with matching keys. - Replace hardcoded colors with
DynamicResourcebindings (orAppThemeBindingmarkup) throughout XAML pages. - Add system theme detection via
Application.Current.RequestedThemeand theRequestedThemeChangedevent. - Implement user preference persistence with
Preferences.Set/Preferences.Getand apply on startup. - Verify Android
ConfigChanges.UiModeis set onMainActivityto avoid activity restarts on theme change. - Test both light and dark themes on at least one target platform, confirming all UI elements respond correctly.
Rules That Change the Answer
Check these rules against the user's scenario, and apply only the ones that
affect what they asked. UiMode and dictionary swapping matter for runtime theme
switching; they are noise in a question about setting up AppThemeBinding.
Answer narrowly, but completely. Completeness means showing the code that
implements what you recommended β not adding adjacent topics. If you recommend
DynamicResource, show the dictionary swap that makes it update. If the user asks
for light/dark colours in C#, show both SetAppThemeColor (colours) and the
generic SetAppTheme<T> (any bindable property type), and prefer resource keys over
scattered hardcoded colours. Do not tack on platform configuration the question
didn't raise.
| Rule | Do this | Not this | Why |
|---|---|---|---|
| Runtime-swapped values must be dynamic | {DynamicResource Key} |
{StaticResource Key} |
StaticResource resolves once at load and never updates when dictionaries are swapped. |
Android must declare UiMode (only for runtime/system theme switching) |
Include ConfigChanges.UiMode in the ConfigurationChanges list on MainActivity |
Omitting it | Without it Android restarts the activity on theme change β navigation state is lost and it looks like a crash. Irrelevant to a static AppThemeBinding setup |
Force a theme via UserAppTheme |
Application.Current.UserAppTheme = AppTheme.Dark |
Manually re-assigning colors | UserAppTheme overrides the OS; AppTheme.Unspecified returns to following the system. |
Do not replace a working AppThemeBinding setup with ResourceDictionary
swapping (or vice versa) unless the user needs what the other approach provides β
more than two themes, or a user-selectable theme.
Choosing an Approach
| Approach | Best for | Limitation |
|---|---|---|
| AppThemeBinding | Automatic light/dark with OS β minimal code | Only two themes (light + dark) |
| ResourceDictionary swap | Custom branded themes, more than two themes, user preference | More setup; must use DynamicResource everywhere |
| Both combined | OS-driven response plus custom theme colors | Most flexible but most complex |
AppThemeBinding (OS Light/Dark)
AppThemeBinding selects a value based on the current system theme. It supports Light, Dark,
FAQ
Does it follow the system theme?
Yes. The skill covers responding to the system theme and to the user's own choice.
Does it cover localization?
No. Language switching is covered by separate guidance.
Does it cover app icons?
No. App icons and splash screens are outside its scope.
Details
Original description by the author
Guide for theming .NET MAUI apps β light/dark mode via AppThemeBinding, ResourceDictionary theme switching, DynamicResource bindings, system theme detection, and user theme preferences. Use when: "dark mode", "light mode", "theming", "AppThemeBinding", "theme switching", "ResourceDictionary theme", "dynamic resources", "system theme detection", "color scheme", "app theme", "DynamicResource". Do not use for: localization or language switching (see .NET MAUI localization documentation), accessibility visual adjustments (see .NET MAUI accessibility documentation), app icons or splash screens (see
repo: dotnet/skills
Popularity
- GitHub stars
- 5.8k
- Ranking position
- #14589
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
create-custom-agent
5.8kHelps your agent create VS Code custom agent files with their own tools, instructions and handoffs to other agents.
create-skill
5.8kHelps your agent create a new agent skill with a valid name, a clear trigger description and a SKILL.md file that follows the standard.
csharp-scripts
5.8kHelps your agent run a small C# program as a single file with the .NET command line tool, without creating a full project.
dotnet-pinvoke
5.8kHelps your agent call native C or C++ libraries from .NET correctly, covering signatures, string handling, memory and safe handles.
Similar skills
android-clean-architecture
280kMakes your agent organize Android projects efficiently. It structures the code to make maintenance and new feature development easier.
compose-multiplatform-patterns
280kHelps your agent use Compose Multiplatform and Jetpack Compose patterns in KMP projects, covering state, navigation, theming, and performance.
dart-flutter-patterns
280kMakes your agent write code for Dart and Flutter apps. It uses modern patterns to create robust and manageable apps.