Convert chrome-local color constants to theme-aware accessors
The previous theme refactor only flipped `colors::*` tokens; the
~50 chrome-local `const FOO: u32 = 0xffffff…;` overlays kept their
white-glass values, so dark mode still painted a light omnibar pill,
light search field, light sidebar tab card, light command-overlay
backdrop, light sync page chips, etc.
Promote `colors::pick(light, dark)` to `pub` so component-internal
constants can reach the same thread-local mode the global palette
uses, then convert every white-glass (`0xffffff??`) and warm-dark
wash (`0x281e14??`) constant in:
- chrome/topbar (omnibar pill, hover chip)
- chrome/sidebar_chrome + chrome/sidebar (rail nav row hover/active,
highlight border, close-button hover, unread badge)
- chrome/sidebar_header (workspace picker, disclosure card)
- chrome/command_overlay + chrome/command_rows + chrome/command_footer
- chrome/settings_layout, chrome/appearance_form,
chrome/appearance_layout_cards, chrome/plugin_detail_view
- chrome/home/style (search field, arrow chip, pill, card, add-tile)
- internal_pages/sync (status pill, metrics card, button row)
- internal_pages/plugin_catalog
- shell/render (main pane highlight border)
Each constant becomes `fn name() -> u32 { colors::pick(<light>, <dark>) }`
where the dark counterpart preserves the original alpha but swaps the
warm-white prefix `ffffff` for warm-graphite `1f1d1b` (or the inverse:
`281e14` warm-dark wash → `f2efe9` warm-white wash). Brand accents
(`0xc96442??`, `0xffaa7733`) and the global slate backdrop keep their
single value across modes.
This commit is contained in:
@@ -200,7 +200,7 @@ fn translucency_preset(
|
||||
.px(px(10.0))
|
||||
.py(px(4.0))
|
||||
.rounded(px(6.0))
|
||||
.bg(rgba(SEGMENT_BG))
|
||||
.bg(rgba(segment_bg()))
|
||||
.text_size(px(11.5))
|
||||
.font_weight(FontWeight(500.0))
|
||||
.text_color(rgb(colors::ink_2()))
|
||||
@@ -224,7 +224,7 @@ fn render_theme_mode_row(active: ThemeMode, cx: &mut Context<ElyShell>) -> AnyEl
|
||||
.gap(px(2.0))
|
||||
.p(px(2.0))
|
||||
.rounded(px(8.0))
|
||||
.bg(rgba(SEGMENT_BG))
|
||||
.bg(rgba(segment_bg()))
|
||||
.child(theme_segment("System", ThemeMode::System, active, cx))
|
||||
.child(theme_segment("Light", ThemeMode::Light, active, cx))
|
||||
.child(theme_segment("Dark", ThemeMode::Dark, active, cx))
|
||||
@@ -326,7 +326,7 @@ fn render_reset_row(cx: &mut Context<ElyShell>) -> AnyElement {
|
||||
.px(px(12.0))
|
||||
.py(px(7.0))
|
||||
.rounded(px(8.0))
|
||||
.bg(rgba(SEGMENT_BG))
|
||||
.bg(rgba(segment_bg()))
|
||||
.text_size(px(12.0))
|
||||
.font_weight(FontWeight(500.0))
|
||||
.text_color(rgb(colors::ink_2()))
|
||||
@@ -399,4 +399,6 @@ fn transparent_like(color: Hsla) -> Hsla {
|
||||
hsla(color.h, color.s, color.l, 0.0)
|
||||
}
|
||||
|
||||
const SEGMENT_BG: u32 = 0x281e140d;
|
||||
fn segment_bg() -> u32 {
|
||||
colors::pick(0x281e140d, 0xf2efe90d)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user