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:
2026-05-15 20:22:51 -04:00
parent 467dcb1f87
commit 39d10bf3d7
20 changed files with 227 additions and 121 deletions
@@ -32,7 +32,7 @@ pub(crate) fn render_plugin_detail_view(
.mx_auto()
.p(px(24.0))
.rounded(px(16.0))
.bg(rgba(CARD_BG))
.bg(rgba(card_bg()))
.grid()
.grid_cols(8)
.gap(px(24.0))
@@ -138,13 +138,13 @@ where
.id(SharedString::from("plugin-detail-secondary"))
.size(px(40.0))
.rounded(px(10.0))
.bg(rgba(SECONDARY_BG))
.bg(rgba(secondary_bg()))
.flex()
.items_center()
.justify_center()
.text_color(rgb(colors::ink_3()))
.cursor_pointer()
.hover(|style| style.bg(rgba(SECONDARY_BG_HOVER)).text_color(rgb(colors::ink())))
.hover(|style| style.bg(rgba(secondary_bg_hover())).text_color(rgb(colors::ink())))
.active(|style| style.opacity(0.82))
.on_click(cx.listener(move |shell, _, window, cx| handler(shell, window, cx)))
.child(icon)
@@ -304,7 +304,7 @@ fn stat_card(label: &'static str, value: String) -> AnyElement {
.px(px(12.0))
.py(px(10.0))
.rounded(px(10.0))
.bg(rgba(STAT_BG))
.bg(rgba(stat_bg()))
.flex()
.flex_col()
.gap(px(2.0))
@@ -358,7 +358,7 @@ fn render_contribution_row(contribution: &PluginContributionPoint) -> AnyElement
.px(px(12.0))
.py(px(10.0))
.rounded(px(10.0))
.bg(rgba(CONTRIBUTION_BG))
.bg(rgba(contribution_bg()))
.child(
div()
.size(px(18.0))
@@ -401,9 +401,19 @@ fn category_label(plugin: &InstalledPlugin) -> &'static str {
if high_risk { "ELY · AUDIT NEEDED" } else { "ELY · SANDBOXED" }
}
const CARD_BG: u32 = 0xffffffd9;
const SECONDARY_BG: u32 = 0xffffffd9;
const SECONDARY_BG_HOVER: u32 = 0xffffffeb;
const STAT_BG: u32 = 0xffffffb3;
const CONTRIBUTION_BG: u32 = 0xffffff8c;
fn card_bg() -> u32 {
colors::pick(0xffffffd9, 0x1f1d1bd9)
}
fn secondary_bg() -> u32 {
colors::pick(0xffffffd9, 0x1f1d1bd9)
}
fn secondary_bg_hover() -> u32 {
colors::pick(0xffffffeb, 0x1f1d1beb)
}
fn stat_bg() -> u32 {
colors::pick(0xffffffb3, 0x1f1d1bb3)
}
fn contribution_bg() -> u32 {
colors::pick(0xffffff8c, 0x1f1d1b8c)
}
const CONTRIBUTION_BADGE_BG: u32 = 0xc964421f;