본문으로 건너뛰기
Skillpedia
모바일 앱5.8k · #14589

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-theming/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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

Inputs

  • A .NET MAUI project targeting .NET 8 or later
  • XAML pages or C# UI code that need theme-aware styling

Workflow

  1. Detect the current theme approach in the project (AppThemeBinding, ResourceDictionary, or none).
  2. Choose the appropriate strategy: AppThemeBinding for simple light/dark, ResourceDictionary swap for custom/multiple themes, or both combined.
  3. Define theme resources — inline AppThemeBinding values or separate ResourceDictionary files with matching keys.
  4. Replace hardcoded colors with DynamicResource bindings (or AppThemeBinding markup) throughout XAML pages.
  5. Add system theme detection via Application.Current.RequestedTheme and the RequestedThemeChanged event.
  6. Implement user preference persistence with Preferences.Set / Preferences.Get and apply on startup.
  7. Verify Android ConfigChanges.UiMode is set on MainActivity to avoid activity restarts on theme change.
  8. 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬