From 5616744c0416776cf28b4e4ad9691477917c1f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 10 Jul 2026 21:41:04 -0400 Subject: [PATCH] fix: decode sync accent as opaque RGB --- agents.md | 2 ++ .../ely_app/src/shell/internal_pages/sync.rs | 9 +++---- .../src/shell/internal_pages/sync_controls.rs | 24 +++++++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/agents.md b/agents.md index b0fb10a..7af410e 100644 --- a/agents.md +++ b/agents.md @@ -159,5 +159,7 @@ the trigger to ungate clipboard/geolocation/notification/webrtc prefs. - Red-green: reproduce with a failing test before fixing. - Files stay under 500 lines (CI-enforced); split like `runtime.rs`/`runtime_paint.rs` or `state/local_visibility.rs`. +- GPUI color encoding is explicit: pass 24-bit `RRGGBB` tokens to `rgb()` and + 32-bit `RRGGBBAA` tokens to `rgba()`. - Tracing targets: `ely::sync`, `ely::local_state` — add spans/fields on every new failure path so field issues are diagnosable. diff --git a/crates/ely_app/src/shell/internal_pages/sync.rs b/crates/ely_app/src/shell/internal_pages/sync.rs index 9f34f79..8bc34c1 100644 --- a/crates/ely_app/src/shell/internal_pages/sync.rs +++ b/crates/ely_app/src/shell/internal_pages/sync.rs @@ -11,9 +11,10 @@ use gpui_component::{input::Input, scroll::ScrollableElement}; use crate::shell::auth::AuthFlowPhase; use super::sync_controls::{ - button_bg, render_card_heading, render_dual_button_row, render_field_label, - render_inline_error, render_input, render_policy_toggle, render_primary_button, - render_reset_button, render_secondary_button, render_sign_out_button, render_sync_now_button, + button_bg, primary_control_background, render_card_heading, render_dual_button_row, + render_field_label, render_inline_error, render_input, render_policy_toggle, + render_primary_button, render_reset_button, render_secondary_button, render_sign_out_button, + render_sync_now_button, }; use super::{ElyShell, render_canvas_surface}; impl ElyShell { @@ -291,7 +292,7 @@ fn render_device_approve_button( .px(px(12.0)) .py(px(8.0)) .rounded(px(8.0)) - .bg(rgba(colors::accent())) + .bg(primary_control_background()) .text_size(px(12.0)) .font_weight(FontWeight(500.0)) .text_color(rgb(0xfff5e6)) diff --git a/crates/ely_app/src/shell/internal_pages/sync_controls.rs b/crates/ely_app/src/shell/internal_pages/sync_controls.rs index 5385672..f5d3a22 100644 --- a/crates/ely_app/src/shell/internal_pages/sync_controls.rs +++ b/crates/ely_app/src/shell/internal_pages/sync_controls.rs @@ -1,8 +1,8 @@ use ely_design_system::colors; use ely_domain::{SyncObjectPolicy, SyncObjectStatus}; use gpui::{ - AnyElement, Context, FontWeight, InteractiveElement, IntoElement, ParentElement, SharedString, - StatefulInteractiveElement, Styled, div, prelude::FluentBuilder, px, rgb, rgba, + AnyElement, Context, FontWeight, InteractiveElement, IntoElement, ParentElement, Rgba, + SharedString, StatefulInteractiveElement, Styled, div, prelude::FluentBuilder, px, rgb, rgba, }; use gpui_component::{ Disableable, IconName, Sizable, @@ -13,6 +13,10 @@ use gpui_component::{ use crate::shell::ElyShell; use crate::shell::chrome::animations::{chrome_motion_feedback, toggle_thumb_motion}; +pub(super) fn primary_control_background() -> Rgba { + rgb(colors::accent()) +} + pub(super) fn render_primary_button( shell: &ElyShell, id: &'static str, @@ -30,7 +34,7 @@ where .px(px(14.0)) .py(px(8.0)) .rounded(px(8.0)) - .bg(rgba(colors::accent())) + .bg(primary_control_background()) .text_size(px(12.5)) .font_weight(FontWeight(500.0)) .text_color(rgb(0xfff5e6)) @@ -155,7 +159,7 @@ pub(super) fn render_policy_toggle( let enabled = status.policy() == SyncObjectPolicy::Enabled; let next_policy = if enabled { SyncObjectPolicy::Paused } else { SyncObjectPolicy::Enabled }; let kind = status.kind(); - let track_color = if enabled { colors::accent() } else { 0x281e1426 }; + let track_color = if enabled { primary_control_background() } else { rgba(0x281e1426) }; let id = SharedString::from(format!("sync-policy-{index}")); let press_id = shell.chrome_motion_animation_id(id.as_str()); let thumb_press_id = press_id.clone(); @@ -166,7 +170,7 @@ pub(super) fn render_policy_toggle( .w(px(34.0)) .h(px(20.0)) .rounded_full() - .bg(rgba(track_color)) + .bg(track_color) .p(px(2.0)) .cursor_pointer() .hover(|style| style.opacity(0.9)) @@ -227,3 +231,13 @@ pub(super) fn button_bg() -> u32 { fn button_bg_hover() -> u32 { colors::pick(0xffffffeb, 0x1f1d1beb) } + +#[cfg(test)] +mod tests { + use super::primary_control_background; + + #[test] + fn primary_control_background_is_opaque_brand_accent() { + assert_eq!(u32::from(primary_control_background()), 0xc96442ff); + } +}