feat(gpui_widgets): add olive theme system with runtime switching

W7 of the oak task list. OakTheme::olive_dark/olive_light translate oak's
palette.ini files into a structured theme (window/base/alternate/accent/
link/disabled plus a derived border). apply_theme swaps gpui's GlobalColors
so every widget reading cx.default_colors() re-themes immediately, and
stores the full theme in a ThemeGlobal. Palette contrast and mapping are
unit-tested, with a gpui::test verifying the runtime switch;
examples/themes.rs toggles between the two themes live. 101 widget tests
pass.
This commit is contained in:
2026-08-09 06:31:44 +08:00
parent bdb1684de7
commit 098d422628
5 changed files with 329 additions and 1 deletions
+7 -1
View File
@@ -126,8 +126,14 @@
## W7. 主题系统
- [ ] 设计系统:把 oak 的 olive-dark/olive-light QSS 翻译成 gpui
- [x] 设计系统:把 oak 的 olive-dark/olive-light QSS 翻译成 gpui
的 `Colors`/样式结构,支持运行期切换。
> `gpui_widgets::theme`:`OakTheme::olive_dark()/olive_light()`
> 从 `oak/app/ui/style/olive-*/palette.ini` 提取(window/base/
> accent/link/disabled 等 + 派生 border);`apply_theme` 同时设置
> gpui 的 `GlobalColors`(所有读 `cx.default_colors()` 的控件立即
> 换肤)与扩展的 `ThemeGlobal`。调色板对比度/映射单测 +
> `#[gpui::test]` 运行期切换验证。`examples/themes.rs`。
## 顺序与验收