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:
@@ -55,7 +55,7 @@ fn render_status_pill(snapshot: &BrowserSnapshot) -> AnyElement {
|
||||
.px(px(12.0))
|
||||
.py(px(5.0))
|
||||
.rounded(px(999.0))
|
||||
.bg(rgba(PILL_BG))
|
||||
.bg(rgba(pill_bg()))
|
||||
.text_size(px(11.0))
|
||||
.text_color(rgb(colors::ink_3()))
|
||||
.child(div().text_color(rgb(colors::accent())).child(IconName::Globe))
|
||||
@@ -93,7 +93,7 @@ fn render_metrics_card(snapshot: &BrowserSnapshot, cx: &mut Context<ElyShell>) -
|
||||
.max_w(px(380.0))
|
||||
.p(px(20.0))
|
||||
.rounded(px(16.0))
|
||||
.bg(rgba(CARD_BG))
|
||||
.bg(rgba(card_bg()))
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap(px(16.0))
|
||||
@@ -160,12 +160,12 @@ fn render_reset_button(cx: &mut Context<ElyShell>) -> AnyElement {
|
||||
.px(px(12.0))
|
||||
.py(px(7.0))
|
||||
.rounded(px(8.0))
|
||||
.bg(rgba(BUTTON_BG))
|
||||
.bg(rgba(button_bg()))
|
||||
.text_size(px(12.0))
|
||||
.font_weight(FontWeight(500.0))
|
||||
.text_color(rgb(colors::ink_2()))
|
||||
.cursor_pointer()
|
||||
.hover(|style| style.bg(rgba(BUTTON_BG_HOVER)))
|
||||
.hover(|style| style.bg(rgba(button_bg_hover())))
|
||||
.active(|style| style.opacity(0.85))
|
||||
.on_click(cx.listener(|shell, _, _, cx| shell.reset_sync_settings(cx)))
|
||||
.child("Reset to defaults"),
|
||||
@@ -186,7 +186,7 @@ fn render_what_syncs_card(snapshot: &BrowserSnapshot, cx: &mut Context<ElyShell>
|
||||
div()
|
||||
.p(px(18.0))
|
||||
.rounded(px(16.0))
|
||||
.bg(rgba(CARD_BG))
|
||||
.bg(rgba(card_bg()))
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap(px(12.0))
|
||||
@@ -370,7 +370,15 @@ fn sync_object_state_label(state: SyncObjectState) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
const PILL_BG: u32 = 0xffffffb3;
|
||||
const CARD_BG: u32 = 0xffffffd9;
|
||||
const BUTTON_BG: u32 = 0xffffffd9;
|
||||
const BUTTON_BG_HOVER: u32 = 0xffffffeb;
|
||||
fn pill_bg() -> u32 {
|
||||
colors::pick(0xffffffb3, 0x1f1d1bb3)
|
||||
}
|
||||
fn card_bg() -> u32 {
|
||||
colors::pick(0xffffffd9, 0x1f1d1bd9)
|
||||
}
|
||||
fn button_bg() -> u32 {
|
||||
colors::pick(0xffffffd9, 0x1f1d1bd9)
|
||||
}
|
||||
fn button_bg_hover() -> u32 {
|
||||
colors::pick(0xffffffeb, 0x1f1d1beb)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user