maui-theming
하는 일
이 스킬은 .NET MAUI 앱의 테마를 안내합니다. 밝은 모드와 어두운 모드, 사용자 정의 색상 테마가 포함됩니다. 앱이 시스템 테마를 따르거나 사용자가 고를 수 있게 하려는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓.NET MAUI 앱이 밝은 모드와 어두운 모드를 지원하게 하고 싶을 때.
- ✓실행 중에 테마를 바꾸거나 사용자가 테마를 고르게 하고 싶을 때.
- ✓리소스 사전으로 브랜드 색상 테마를 설정하고 싶을 때.
스킬 링크
https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-theming/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 MAUI 앱에 어두운 모드를 추가하고, 사용자가 설정에서 밝은 모드, 어두운 모드, 시스템 테마 중 고를 수 있게 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트가 단순한 밝은 색과 어두운 색에는 테마 바인딩을 쓰고, 사용자 정의 테마에는 리소스 사전을 교체하며, 시스템 테마와 사용자의 선택에 모두 반응하도록 합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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,
자주 묻는 질문
시스템 테마를 따르나요?
네. 시스템 테마와 사용자가 직접 고른 설정에 반응하는 방법을 다룹니다.
지역화도 다루나요?
아니요. 언어 전환은 별도의 안내에서 다룹니다.
앱 아이콘도 다루나요?
아니요. 앱 아이콘과 스플래시 화면은 범위 밖입니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 5.8k
- 순위
- #14589
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
create-custom-agent
5.8k에이전트가 자체 도구, 지침, 다른 에이전트로의 핸드오프를 가진 VS Code 커스텀 에이전트 파일을 만들도록 돕습니다.
create-skill
5.8k에이전트가 올바른 이름, 명확한 트리거 설명, 표준을 따르는 SKILL.md 파일로 새 에이전트 스킬을 만들도록 돕습니다.
csharp-scripts
5.8k에이전트가 .NET 명령줄 도구로 작은 C# 프로그램을 전체 프로젝트 없이 단일 파일로 실행하도록 돕습니다.
dotnet-pinvoke
5.8k에이전트가 .NET에서 네이티브 C나 C++ 라이브러리를 올바르게 호출하도록 돕습니다. 시그니처, 문자열 처리, 메모리, 안전 핸들을 다룹니다.
비슷한 스킬
android-clean-architecture
280k에이전트가 Android 프로젝트를 효율적으로 구성하도록 돕습니다. 유지보수와 새 기능 개발이 쉽도록 코드를 구조화합니다.
compose-multiplatform-patterns
280k에이전트가 KMP 프로젝트에서 Compose Multiplatform과 Jetpack Compose 패턴을 쓰도록 돕습니다. 상태, 내비게이션, 테마, 성능을 다룹니다.
dart-flutter-patterns
280kDart와 Flutter 앱용 코드를 작성하도록 에이전트를 돕습니다. 견고하고 관리하기 쉬운 앱을 만드는 현대적인 패턴을 씁니다.