Skip to main content

uno-toolkit-system-theme-helper

Use SystemThemeHelper to detect system theme (light/dark), check if dark mode is active, and set application theme. Provides static methods for theme retrieval and management.

跳到安装

来源信息

仓库
unoplatform/studio
最近来源活动
2026年6月9日 19:39
检测到的 SKILL.md 语言
英语
星标
10
分支
1

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
uno-toolkit-system-theme-helper
description
Use SystemThemeHelper to detect system theme (light/dark), check if dark mode is active, and set application theme. Provides static methods for theme retrieval and management.
when_to_use
Use when reading or programmatically switching dark / light mode from C# (not the XAML `ThemeResource` lookup path) — detecting the current system theme, setting the application theme at runtime, or toggling between modes.
metadata
{"author":"uno-platform","version":"2.4","category":"toolkit"}
# Uno Toolkit SystemThemeHelper — Agent Skill ## Workflow > **Docs lookup:** call `uno_platform_docs_search(...)` first, then `uno_platform_docs_fetch(sourcePath="…")` using the `sourcePath` field from a result (a relative `.md` path; add the result's `anchor` for a section). Never pass a URL, a `.html` link, or a hand-built path. ### Step 1: Fetch the SystemThemeHelper Documentation ``` uno_platform_docs_search("Uno Toolkit SystemThemeHelper theme light dark mode detect") ``` Primary documentation page: - **SystemThemeHelper**: `external/uno.toolkit.ui/doc/helpers/SystemThemeHelper.md` Fetch the page: ``` uno_platform_docs_fetch(sourcePath="external/uno.toolkit.ui/doc/helpers/SystemThemeHelper.md") ``` ## Key Principles (Stable) - `SystemThemeHelper.GetCurrentOsTheme()` — returns `ApplicationTheme.Light` or `ApplicationTheme.Dark` - `SystemThemeHelper.GetRootTheme(XamlRoot?)` — gets the app theme for a given XamlRoot - `SystemThemeHelper.IsRootInDarkMode(XamlRoot?)` — quick check if dark mode is active - `SystemThemeHelper.SetRootTheme(XamlRoot?, bool)` — set theme (`true` = dark) - `SystemThemeHelper.SetApplicationTheme(XamlRoot?, ElementTheme)` — set theme using ElementTheme enum - **No `ThemeChanged` event exists** — there is no event to subscribe to for theme changes - Namespace: `using Uno.Toolkit.UI;` ## Related Skills - [[uno-themes-semantic-colors-brushes]] — Semantic color palette and brush system
在 GitHub 查看