README.md

nativeTheme API 列表

本模块包含 7 个 API。

Events(事件)

API 说明 鸿蒙支持
updated 当底层 NativeTheme 发生变化时触发,通常意味着 shouldUseDarkColors、shouldUseHighContrastColors 或 shouldUseInvertedColorScheme 的值发生了改变。 支持

Properties(属性)

API 说明 鸿蒙支持
nativeTheme.shouldUseDarkColors boolean,表示系统或 Chromium 当前是否启用了深色模式,如需修改此值请使用 themeSource。 支持
nativeTheme.themeSource string 属性,可设置为 system、light 或 dark,用于覆盖 Chromium 内部选定的主题。 支持
nativeTheme.shouldUseHighContrastColors boolean,表示系统或 Chromium 当前是否启用了高对比度模式。 不支持
nativeTheme.shouldUseInvertedColorScheme boolean,表示系统或 Chromium 当前是否启用了反色方案。 不支持
nativeTheme.inForcedColorsMode boolean,表示 Chromium 是否处于强制颜色模式(由系统辅助功能设置控制),目前仅 Windows 高对比度设置会触发此模式。 不支持
nativeTheme.prefersReducedTransparency boolean,表示用户是否通过系统辅助功能设置选择了降低系统透明度。 支持