diff --git a/crates/chat_ui/src/lib.rs b/crates/chat_ui/src/lib.rs index cbde582f..5137a52d 100644 --- a/crates/chat_ui/src/lib.rs +++ b/crates/chat_ui/src/lib.rs @@ -904,8 +904,8 @@ impl ChatPanel { .h_10() .justify_center() .text_sm() - .bg(cx.theme().elevated_surface_background) - .rounded(cx.theme().radius) + .bg(cx.theme().surface_raised) + .rounded(px(theme::panel_radius())) .child("Message isn't traced yet"), ) }) @@ -919,8 +919,8 @@ impl ChatPanel { .h_7() .px_2() .gap_2() - .bg(cx.theme().elevated_surface_background) - .rounded(cx.theme().radius) + .bg(cx.theme().surface_raised) + .rounded(px(theme::control_radius())) .text_sm() .child(div().size_1p5().rounded_full().bg(gpui::green())) .child(SharedString::from(url.to_string())), @@ -951,8 +951,8 @@ impl ChatPanel { .h_7() .px_2() .gap_2() - .bg(cx.theme().elevated_surface_background) - .rounded(cx.theme().radius) + .bg(cx.theme().surface_raised) + .rounded(px(theme::control_radius())) .text_sm() .child(div().size_1p5().rounded_full().bg(gpui::green())) .child(SharedString::from(url.to_string())), @@ -975,7 +975,7 @@ impl ChatPanel { svg() .path("brand/coop.svg") .size_12() - .text_color(cx.theme().ghost_element_background_alt), + .text_color(cx.theme().surface_raised), ) .message(PRIVATE_NOTICE) .into_any_element() @@ -991,13 +991,13 @@ impl ChatPanel { .justify_center() .text_center() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .line_height(relative(1.3)) .child( svg() .path("brand/coop.svg") .size_12() - .text_color(cx.theme().ghost_element_active), + .text_color(cx.theme().element_active), ) .child(PRIVATE_NOTICE) .into_any_element() @@ -1020,8 +1020,8 @@ impl ChatPanel { .size_8() .justify_center() .rounded_full() - .bg(cx.theme().warning_background) - .text_color(cx.theme().warning_foreground) + .bg(cx.theme().warning_muted) + .text_color(cx.theme().warning) .child(Icon::new(IconName::Warning).small()), ) .child( @@ -1161,7 +1161,7 @@ impl ChatPanel { .top_0() .w(px(2.)) .h_full() - .bg(cx.theme().border_transparent), + .bg(gpui::transparent_black()), ) .overlay(self.render_actions(&id, &pk, cx)) .on_mouse_down( @@ -1187,10 +1187,10 @@ impl ChatPanel { return div().child( img(media[0].clone()) .border_1() - .border_color(cx.theme().border_variant) + .border_color(cx.theme().border_faint) .h(px(250.)) .object_fit(ObjectFit::Cover) - .rounded(cx.theme().radius), + .rounded(px(theme::bubble_radius())), ); } @@ -1215,8 +1215,8 @@ impl ChatPanel { img(item.clone()) .h_32() .border_1() - .border_color(cx.theme().border_variant) - .rounded(cx.theme().radius), + .border_color(cx.theme().border_faint) + .rounded(px(theme::bubble_radius())), ), ); } @@ -1254,7 +1254,7 @@ impl ChatPanel { .line_clamp(1) .child(message.preview()), ) - .hover(|this| this.bg(cx.theme().elevated_surface_background)) + .hover(|this| this.bg(cx.theme().surface_raised)) .on_click({ let id = *id; cx.listener(move |this, _event, _window, _cx| { @@ -1290,13 +1290,13 @@ impl ChatPanel { .gap_2() .py_0p5() .px_1() - .rounded(cx.theme().radius) + .rounded(px(theme::control_radius())) .text_xs() .border_1() .when(has_reacted, |this| { - this.text_color(cx.theme().secondary_foreground) - .bg(cx.theme().secondary_background) - .border_color(cx.theme().secondary_active) + this.text_color(cx.theme().text) + .bg(cx.theme().surface_raised) + .border_color(cx.theme().element_active) }) .when(!has_reacted, |this| this.border_color(cx.theme().border)) .child(emoji) @@ -1330,7 +1330,7 @@ impl ChatPanel { div() .id(SharedString::from(id.to_hex())) .child(label) - .when(failed, |this| this.text_color(cx.theme().text_danger)) + .when(failed, |this| this.text_color(cx.theme().danger_muted)) .when_some(reports, |this, reports| { this.when(!pending, |this| { this.on_click(move |_e, window, cx| { @@ -1385,9 +1385,9 @@ impl ChatPanel { .h_16() .w_full() .text_sm() - .rounded(cx.theme().radius) - .bg(cx.theme().warning_background) - .text_color(cx.theme().warning_foreground) + .rounded(px(theme::surface_radius())) + .bg(cx.theme().warning_muted) + .text_color(cx.theme().warning) .child(div().flex_1().w_full().text_center().child(error)), ) }) @@ -1405,8 +1405,8 @@ impl ChatPanel { .gap_0p5() .p_1() .w_full() - .rounded(cx.theme().radius) - .bg(cx.theme().danger_background) + .rounded(px(theme::surface_radius())) + .bg(cx.theme().danger.opacity(0.06)) .child( div() .text_xs() @@ -1417,7 +1417,7 @@ impl ChatPanel { .child( div() .text_xs() - .text_color(cx.theme().danger_foreground) + .text_color(cx.theme().danger_muted.opacity(0.9)) .line_height(relative(1.25)) .child(SharedString::from(msg.to_string())), ), @@ -1435,8 +1435,8 @@ impl ChatPanel { .gap_0p5() .p_1() .w_full() - .rounded(cx.theme().radius) - .bg(cx.theme().elevated_surface_background) + .rounded(px(theme::surface_radius())) + .bg(cx.theme().surface_card) .child( div() .text_xs() @@ -1473,10 +1473,10 @@ impl ChatPanel { .right_4() .top_neg_2() .when(cx.theme().shadow, |this| this.shadow_sm()) - .rounded(cx.theme().radius) + .rounded(px(theme::surface_radius())) .border_1() .border_color(cx.theme().border) - .bg(cx.theme().background) + .bg(cx.theme().bg) .children({ let mut items = vec![]; @@ -1553,7 +1553,7 @@ impl ChatPanel { img(url.as_str()) .size_16() .when(cx.theme().shadow, |this| this.shadow_lg()) - .rounded(cx.theme().radius) + .rounded(px(theme::control_radius())) .object_fit(ObjectFit::Cover), ) .child( @@ -1611,10 +1611,10 @@ impl ChatPanel { .child( img(path.clone()) .border_1() - .border_color(cx.theme().border_variant) + .border_color(cx.theme().border_faint) .h(px(250.)) .object_fit(ObjectFit::Cover) - .rounded(cx.theme().radius), + .rounded(px(theme::bubble_radius())), ) .into_any_element(); } @@ -1645,9 +1645,9 @@ impl ChatPanel { .gap_2() .p_2() .border_1() - .border_color(cx.theme().border_variant) - .rounded(cx.theme().radius) - .child(Icon::new(IconName::Lock).text_color(cx.theme().icon_accent)) + .border_color(cx.theme().border_faint) + .rounded(px(theme::control_radius())) + .child(Icon::new(IconName::Lock).text_color(cx.theme().accent)) .child( v_flex() .min_w_0() @@ -1657,7 +1657,7 @@ impl ChatPanel { .child( div() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(label), ), ) @@ -1688,7 +1688,7 @@ impl ChatPanel { img(pending.path.clone()) .size_16() .when(cx.theme().shadow, |this| this.shadow_sm()) - .rounded(cx.theme().radius) + .rounded(px(theme::control_radius())) .object_fit(ObjectFit::Cover), ) } else { @@ -1698,10 +1698,10 @@ impl ChatPanel { .flex() .items_center() .justify_center() - .rounded(cx.theme().radius) + .rounded(px(theme::control_radius())) .border_1() - .border_color(cx.theme().border_variant) - .bg(cx.theme().surface_background) + .border_color(cx.theme().border_faint) + .bg(cx.theme().surface) .text_xs() .text_center() .child("Preview not available"), @@ -1718,7 +1718,7 @@ impl ChatPanel { .justify_center() .rounded_full() .border_1() - .border_color(cx.theme().border_variant) + .border_color(cx.theme().border_faint) .bg(gpui::green()) .child(Icon::new(IconName::Lock).size_2().text_color(gpui::white())), ) @@ -1767,11 +1767,7 @@ impl ChatPanel { .text_xs() .text_color(cx.theme().text_muted) .child("Replying to:") - .child( - div() - .text_color(cx.theme().text_accent) - .child(profile.name()), - ), + .child(div().text_color(cx.theme().accent).child(profile.name())), ) .child( Button::new("remove-reply") @@ -1994,7 +1990,7 @@ impl Render for ChatPanel { div() .px_1() .text_xs() - .text_color(cx.theme().text_warning) + .text_color(cx.theme().warning) .child(WARNING), ) }) diff --git a/crates/nip29_ui/src/details.rs b/crates/nip29_ui/src/details.rs index 6a4b8bc3..fe52c8c8 100644 --- a/crates/nip29_ui/src/details.rs +++ b/crates/nip29_ui/src/details.rs @@ -3,7 +3,7 @@ use gpui::{ relative, }; use nip29::{Group, GroupMetadata}; -use theme::ActiveTheme; +use theme::{ActiveTheme, control_radius}; use ui::avatar::Avatar; use ui::{Sizable, StyledExt, WindowExtension, h_flex, v_flex}; @@ -76,7 +76,7 @@ fn body(group: &WeakEntity, cx: &App) -> AnyElement { "Supported kinds", if items.is_empty() { div() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child("None") .into_any_element() } else { @@ -145,7 +145,7 @@ fn header(group: &Group, cx: &App) -> AnyElement { .child( div() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .truncate() .child(SharedString::from(format!( "{} · {}", @@ -183,9 +183,9 @@ fn chip(label: impl Into, cx: &App) -> AnyElement { div() .px_2() .py_1() - .rounded(cx.theme().radius) - .bg(cx.theme().secondary_background) - .text_color(cx.theme().secondary_foreground) + .rounded(px(control_radius())) + .bg(cx.theme().surface_raised) + .text_color(cx.theme().text) .text_xs() .line_height(relative(1.)) .child(label.into()) diff --git a/crates/nip29_ui/src/lib.rs b/crates/nip29_ui/src/lib.rs index 3708f1c7..4d8245d3 100644 --- a/crates/nip29_ui/src/lib.rs +++ b/crates/nip29_ui/src/lib.rs @@ -16,7 +16,7 @@ use serde::Deserialize; use settings::AppSettings; use smallvec::{SmallVec, smallvec}; use state::{NostrRegistry, upload}; -use theme::ActiveTheme; +use theme::{ActiveTheme, control_radius}; use ui::avatar::Avatar; use ui::button::{Button, ButtonVariant, ButtonVariants}; use ui::dialog::DialogButtonProps; @@ -576,7 +576,7 @@ impl GroupPanel { .child( Icon::new(IconName::Info) .small() - .text_color(cx.theme().icon_muted), + .text_color(cx.theme().text_faint), ) .child(div().flex_1().min_w_0().truncate().child(message)) .child( @@ -615,8 +615,8 @@ impl GroupPanel { div() .px_1p5() .py_0p5() - .rounded(cx.theme().radius) - .bg(cx.theme().element_background) + .rounded(px(control_radius())) + .bg(cx.theme().solid) .text_xs() .text_color(cx.theme().text_muted) .child(pin_label(group, pin)) @@ -878,8 +878,8 @@ impl GroupPanel { .h_8() .px_2() .border_1() - .border_color(cx.theme().border_variant) - .rounded(cx.theme().radius) + .border_color(cx.theme().border_faint) + .rounded(px(control_radius())) .text_xs() .text_color(cx.theme().text_muted) .child(Icon::new(IconName::Link).xsmall()) @@ -988,7 +988,7 @@ impl Render for GroupPanel { .size_full() .justify_center() .text_sm() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child("No messages yet") .into_any_element(), }), diff --git a/crates/nip29_ui/src/message.rs b/crates/nip29_ui/src/message.rs index 7bb3b0b2..c0b8e097 100644 --- a/crates/nip29_ui/src/message.rs +++ b/crates/nip29_ui/src/message.rs @@ -9,7 +9,7 @@ use nip29::{Activity, Group}; use nostr_sdk::prelude::{EventId, Kind}; use person::PersonRegistry; use settings::AppSettings; -use theme::ActiveTheme; +use theme::{ActiveTheme, bubble_radius}; use ui::avatar::Avatar; use ui::menu::{ContextMenu, PopupMenu, PopupMenuItem}; use ui::message::MessageRow; @@ -141,7 +141,7 @@ pub(crate) fn render_activity(ix: usize, activity: &Activity, cx: &App) -> AnyEl .gap_2() .py_1() .px_3() - .hover(|this| this.bg(cx.theme().surface_background)) + .hover(|this| this.bg(cx.theme().element_hover)) .child(badge(activity, cx)) .when(!hide_avatar, |this| { this.child( @@ -164,7 +164,7 @@ pub(crate) fn render_activity(ix: usize, activity: &Activity, cx: &App) -> AnyEl .min_w_0() .truncate() .text_sm() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(SharedString::from(action(activity))), ) .child( @@ -172,7 +172,7 @@ pub(crate) fn render_activity(ix: usize, activity: &Activity, cx: &App) -> AnyEl .flex_shrink_0() .ml_1() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(activity.created_at.to_ago()), ) .into_any_element() @@ -180,11 +180,11 @@ pub(crate) fn render_activity(ix: usize, activity: &Activity, cx: &App) -> AnyEl fn badge(activity: &Activity, cx: &App) -> AnyElement { let (icon, color) = match activity.kind { - Kind::GroupJoinRequest => (IconName::Login, cx.theme().icon_accent), - Kind::GroupPutUser => (IconName::Login, cx.theme().icon_accent), - Kind::GroupLeaveRequest => (IconName::Logout, cx.theme().text_danger), - Kind::GroupRemoveUser => (IconName::Ban, cx.theme().text_danger), - _ => (IconName::Info, cx.theme().icon_muted), + Kind::GroupJoinRequest => (IconName::Login, cx.theme().accent), + Kind::GroupPutUser => (IconName::Login, cx.theme().accent), + Kind::GroupLeaveRequest => (IconName::Logout, cx.theme().danger), + Kind::GroupRemoveUser => (IconName::Ban, cx.theme().danger), + _ => (IconName::Info, cx.theme().text_faint), }; h_flex() @@ -211,10 +211,10 @@ fn media(media: &[SharedUri], cx: &App) -> AnyElement { .child( img(only.clone()) .border_1() - .border_color(cx.theme().border_variant) + .border_color(cx.theme().border_faint) .h(px(250.)) .object_fit(ObjectFit::Cover) - .rounded(cx.theme().radius), + .rounded(px(bubble_radius())), ) .into_any_element(); } @@ -231,8 +231,8 @@ fn media(media: &[SharedUri], cx: &App) -> AnyElement { img(item.clone()) .h_32() .border_1() - .border_color(cx.theme().border_variant) - .rounded(cx.theme().radius), + .border_color(cx.theme().border_faint) + .rounded(px(bubble_radius())), ) })) .into_any_element() diff --git a/crates/nip4e/src/lib.rs b/crates/nip4e/src/lib.rs index d4d27ae1..4cc01dd4 100644 --- a/crates/nip4e/src/lib.rs +++ b/crates/nip4e/src/lib.rs @@ -8,14 +8,14 @@ use std::sync::atomic::{AtomicBool, Ordering}; use anyhow::{Context as AnyhowContext, Error, anyhow}; use gpui::{ App, AppContext, Context, Entity, EventEmitter, Global, IntoElement, ParentElement, - SharedString, Styled, Subscription, Task, Window, div, relative, + SharedString, Styled, Subscription, Task, Window, div, px, relative, }; use nostr_sdk::prelude::*; use person::PersonRegistry; use settings::AppSettings; use smallvec::{SmallVec, smallvec}; use state::{Announcement, CLIENT_NAME, NostrRegistry, UniversalSigner}; -use theme::ActiveTheme; +use theme::{ActiveTheme, control_radius}; use ui::avatar::Avatar; use ui::button::Button; use ui::notification::{Notification, NotificationKind}; @@ -747,8 +747,8 @@ impl DeviceRegistry { .h_8() .w_full() .px_2() - .rounded(cx.theme().radius) - .bg(cx.theme().elevated_surface_background) + .rounded(px(control_radius())) + .bg(cx.theme().surface_card) .child( h_flex() .gap_2() @@ -777,8 +777,8 @@ impl DeviceRegistry { .h_8() .w_full() .px_2() - .rounded(cx.theme().radius) - .bg(cx.theme().elevated_surface_background) + .rounded(px(control_radius())) + .bg(cx.theme().surface_card) .child(code_label.clone()), ), ), diff --git a/crates/workspace/src/dialogs/import.rs b/crates/workspace/src/dialogs/import.rs index f9262594..9316e6d9 100644 --- a/crates/workspace/src/dialogs/import.rs +++ b/crates/workspace/src/dialogs/import.rs @@ -7,7 +7,7 @@ use gpui::{ use instant::Duration; use nostr_connect::prelude::*; use state::{CoopAuthUrlHandler, NostrRegistry, USER_KEYRING}; -use theme::ActiveTheme; +use theme::{ActiveTheme, surface_radius}; use ui::button::{Button, ButtonVariants}; use ui::input::{Input, InputEvent, InputState}; use ui::{Disableable, StyledExt, WindowExtension, v_flex}; @@ -248,10 +248,10 @@ impl Render for ImportIdentity { this.child( div() .p_2() - .rounded(cx.theme().radius) - .bg(cx.theme().warning_background) + .rounded(px(surface_radius())) + .bg(cx.theme().warning_muted) .text_xs() - .text_color(cx.theme().warning_foreground) + .text_color(cx.theme().warning) .line_height(relative(1.2)) .child(div().child(BUNKER_WARN)), ) @@ -260,10 +260,10 @@ impl Render for ImportIdentity { this.child( div() .p_2() - .rounded(cx.theme().radius) - .bg(cx.theme().warning_background) + .rounded(px(surface_radius())) + .bg(cx.theme().warning_muted) .text_xs() - .text_color(cx.theme().warning_foreground) + .text_color(cx.theme().warning) .line_height(relative(1.2)) .child(div().child(KEY_WARN)), ) @@ -297,7 +297,7 @@ impl Render for ImportIdentity { div() .text_xs() .text_center() - .text_color(cx.theme().text_danger) + .text_color(cx.theme().danger) .child(error.clone()), ) }) diff --git a/crates/workspace/src/dialogs/new_chat.rs b/crates/workspace/src/dialogs/new_chat.rs index 9a7bc2a7..55200aae 100644 --- a/crates/workspace/src/dialogs/new_chat.rs +++ b/crates/workspace/src/dialogs/new_chat.rs @@ -365,9 +365,9 @@ impl NewChat { .gap_1() .p_0p5() .rounded_full() - .bg(cx.theme().ghost_element_background_alt) + .bg(cx.theme().surface_raised) .text_size(px(10.)) - .hover(|this| this.bg(cx.theme().ghost_element_hover)) + .hover(|this| this.bg(cx.theme().element_hover)) .child( Avatar::from_source(profile.avatar()) .seed(profile.avatar_seed()) @@ -412,17 +412,12 @@ impl Render for NewChat { }) .map(|this| { if let Some(error) = self.error.clone() { - this.child( - div() - .text_xs() - .text_color(cx.theme().text_danger) - .child(error), - ) + this.child(div().text_xs().text_color(cx.theme().danger).child(error)) } else { this.child( div() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(notice), ) } diff --git a/crates/workspace/src/dialogs/profile.rs b/crates/workspace/src/dialogs/profile.rs index aca079b9..379d5f0f 100644 --- a/crates/workspace/src/dialogs/profile.rs +++ b/crates/workspace/src/dialogs/profile.rs @@ -5,14 +5,14 @@ use chat::{ChatRegistry, Room, RoomKind}; use gpui::prelude::FluentBuilder; use gpui::{ App, AppContext, ClipboardItem, Context, Div, Entity, IntoElement, ParentElement, - PathPromptOptions, Render, SharedString, Styled, Task, Window, div, retain_all, + PathPromptOptions, Render, SharedString, Styled, Task, Window, div, px, retain_all, }; use instant::Duration; use nostr_sdk::prelude::*; use person::{Person, PersonRegistry, shorten_pubkey}; use settings::AppSettings; use state::{NostrRegistry, upload}; -use theme::ActiveTheme; +use theme::{ActiveTheme, button_radius}; use ui::avatar::Avatar; use ui::button::{Button, ButtonVariants}; use ui::dock::DockPlacement; @@ -366,7 +366,7 @@ impl Render for ProfileDialog { .w_full() .items_center() .justify_center() - .bg(cx.theme().surface_background) + .bg(cx.theme().surface) .child(Avatar::new(avatar).seed(profile.avatar_seed()).large()) .when(self.editing, |this| { this.child( @@ -391,8 +391,8 @@ impl Render for ProfileDialog { .w_full() .justify_center() .gap_3() - .rounded(cx.theme().radius) - .bg(cx.theme().surface_background) + .rounded(px(button_radius())) + .bg(cx.theme().surface) .text_sm() .child(shorten_pkey) .child( diff --git a/crates/workspace/src/dialogs/relays.rs b/crates/workspace/src/dialogs/relays.rs index 6223c026..99ead7c9 100644 --- a/crates/workspace/src/dialogs/relays.rs +++ b/crates/workspace/src/dialogs/relays.rs @@ -11,7 +11,7 @@ use instant::Duration; use nostr_sdk::prelude::*; use smallvec::{SmallVec, smallvec}; use state::NostrRegistry; -use theme::ActiveTheme; +use theme::{ActiveTheme, button_radius, panel_radius}; use ui::button::{Button, ButtonVariants}; use ui::input::{Input, InputEvent, InputState}; use ui::menu::{DropdownMenu, PopupMenuItem}; @@ -154,7 +154,7 @@ impl RelayManager { div() .italic() .text_xs() - .text_color(cx.theme().text_danger) + .text_color(cx.theme().danger) .child(error.clone()), ) }) @@ -225,7 +225,7 @@ impl RelayManager { div() .italic() .text_xs() - .text_color(cx.theme().text_danger) + .text_color(cx.theme().danger) .child(error.clone()), ) }) @@ -646,8 +646,8 @@ fn relay_row( .h_8() .px_2() .justify_between() - .rounded(cx.theme().radius) - .bg(cx.theme().surface_background) + .rounded(px(button_radius())) + .bg(cx.theme().surface) .child( h_flex() .gap_1() @@ -682,7 +682,7 @@ fn empty_relays(cx: &App) -> impl IntoElement { .border_2() .border_dashed() .border_color(cx.theme().border) - .rounded(cx.theme().radius_lg) + .rounded(px(panel_radius())) .text_sm() .text_align(TextAlign::Center) .child(SharedString::from("Please add some relays.")) diff --git a/crates/workspace/src/dialogs/restore.rs b/crates/workspace/src/dialogs/restore.rs index eeedc759..4e3980d0 100644 --- a/crates/workspace/src/dialogs/restore.rs +++ b/crates/workspace/src/dialogs/restore.rs @@ -126,7 +126,7 @@ impl Render for RestoreEncryption { div() .text_xs() .text_center() - .text_color(cx.theme().text_danger) + .text_color(cx.theme().danger) .child(error.clone()), ) }) diff --git a/crates/workspace/src/dialogs/screening.rs b/crates/workspace/src/dialogs/screening.rs index 787e822f..e47dfbde 100644 --- a/crates/workspace/src/dialogs/screening.rs +++ b/crates/workspace/src/dialogs/screening.rs @@ -12,7 +12,7 @@ use nostr_sdk::prelude::*; use person::{Person, PersonRegistry, shorten_pubkey}; use smallvec::{SmallVec, smallvec}; use state::{BOOTSTRAP_RELAYS, NostrAddress, NostrRegistry, TIMEOUT}; -use theme::ActiveTheme; +use theme::{ActiveTheme, button_radius}; use ui::avatar::Avatar; use ui::button::{Button, ButtonVariants}; use ui::indicator::Indicator; @@ -283,9 +283,9 @@ impl Screening { .w_full() .px_2() .gap_1p5() - .rounded(cx.theme().radius) + .rounded(px(button_radius())) .text_sm() - .hover(|this| this.bg(cx.theme().elevated_surface_background)) + .hover(|this| this.bg(cx.theme().element_hover)) .child(Avatar::new(profile.avatar()).small()) .child(profile.name()), ); @@ -344,7 +344,7 @@ impl Render for Screening { .h_7() .justify_center() .rounded_full() - .bg(cx.theme().elevated_surface_background) + .bg(cx.theme().surface_raised) .text_sm() .truncate() .text_ellipsis() @@ -524,9 +524,9 @@ fn status_badge(status: Option, cx: &App) -> Div { if let Some(status) = status { this.child(Icon::new(IconName::CheckCircle).small().text_color({ if status { - cx.theme().icon_accent + cx.theme().accent } else { - cx.theme().icon_muted + cx.theme().text_faint } })) } else { diff --git a/crates/workspace/src/dialogs/settings.rs b/crates/workspace/src/dialogs/settings.rs index 185c814a..afa123e1 100644 --- a/crates/workspace/src/dialogs/settings.rs +++ b/crates/workspace/src/dialogs/settings.rs @@ -199,7 +199,7 @@ impl Render for Preferences { div() .text_size(px(10.)) .italic() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(SharedString::from("Only support blossom service")), ), ), diff --git a/crates/workspace/src/lib.rs b/crates/workspace/src/lib.rs index 1971226c..51b98e8f 100644 --- a/crates/workspace/src/lib.rs +++ b/crates/workspace/src/lib.rs @@ -15,7 +15,7 @@ use nostr_sdk::prelude::*; use serde::Deserialize; use smallvec::{SmallVec, smallvec}; use state::{NostrRegistry, StateEvent}; -use theme::{ActiveTheme, SIDEBAR_WIDTH, Theme, ThemeRegistry}; +use theme::{ActiveTheme, SIDEBAR_WIDTH, Theme, ThemeRegistry, button_radius}; use ui::button::{Button, ButtonVariants}; use ui::dock::{self, DockArea, DockLayout, DockPlacement, Panel, PanelHandle}; use ui::notification::{Notification, NotificationKind}; @@ -425,7 +425,7 @@ impl Workspace { .child( div() .italic() - .text_color(cx.theme().text_danger) + .text_color(cx.theme().danger) .child(SharedString::from(ENC_WARN)), ), ) @@ -469,9 +469,8 @@ impl Workspace { .h_8() .w_full() .justify_between() - .rounded(cx.theme().radius) - .bg(cx.theme().ghost_element_background) - .hover(|this| this.bg(cx.theme().ghost_element_hover)) + .rounded(px(button_radius())) + .hover(|this| this.bg(cx.theme().element_hover)) .child( h_flex() .gap_1p5() diff --git a/crates/workspace/src/panels/browse.rs b/crates/workspace/src/panels/browse.rs index fc8fe888..8fa21216 100644 --- a/crates/workspace/src/panels/browse.rs +++ b/crates/workspace/src/panels/browse.rs @@ -6,14 +6,14 @@ use gpui::{ AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, ParentElement, Render, ScrollStrategy, SharedString, StatefulInteractiveElement, Styled, Subscription, Task, WeakEntity, Window, div, px, relative, - size, + size, transparent_black, }; use gpui_base::{VirtualListScrollHandle, v_virtual_list}; use nip29::{Discovery, GroupCandidate, GroupKey, GroupsEvent, GroupsRegistry, Membership}; use nostr_sdk::prelude::{RelayUrl, Timestamp}; use settings::AppSettings; use smallvec::{SmallVec, smallvec}; -use theme::ActiveTheme; +use theme::{ActiveTheme, button_radius, panel_radius}; use ui::avatar::Avatar; use ui::button::{Button, ButtonVariants}; use ui::dock::{DockArea, DockPlacement, Panel, PanelEvent, PanelHandle}; @@ -294,8 +294,8 @@ impl BrowsePanel { .w_full() .max_w_64() .px_1() - .rounded(cx.theme().radius) - .bg(cx.theme().surface_background) + .rounded(px(button_radius())) + .bg(cx.theme().surface) .child( Input::new(&self.input) .appearance(false) @@ -375,14 +375,14 @@ impl BrowsePanel { .min_w_0() .h_full() .overflow_hidden() - .rounded(cx.theme().radius) + .rounded(px(panel_radius())) .cursor_pointer() .border_1() - .border_color(cx.theme().border_transparent) - .bg(cx.theme().surface_background) + .border_color(transparent_black()) + .bg(cx.theme().surface) .hover(|this| { - this.bg(cx.theme().elevated_surface_background) - .border_color(cx.theme().border_focused) + this.bg(cx.theme().surface_raised) + .border_color(cx.theme().border_strong) }) .child( v_flex() @@ -414,7 +414,7 @@ impl BrowsePanel { div() .truncate() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(relay), ), ), @@ -467,7 +467,7 @@ impl Panel for BrowsePanel { .child( Icon::new(IconName::Compass) .small() - .text_color(cx.theme().icon_muted), + .text_color(cx.theme().text_faint), ) .child(TITLE) .into_any_element() diff --git a/crates/workspace/src/panels/contact_list.rs b/crates/workspace/src/panels/contact_list.rs index d3f34f37..fe5f19b6 100644 --- a/crates/workspace/src/panels/contact_list.rs +++ b/crates/workspace/src/panels/contact_list.rs @@ -5,14 +5,14 @@ use gpui::prelude::FluentBuilder; use gpui::{ AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, ParentElement, Render, SharedString, Styled, Subscription, - Task, TextAlign, Window, div, rems, retain_all, + Task, TextAlign, Window, div, px, rems, retain_all, }; use instant::Duration; use nostr_sdk::prelude::*; use person::PersonRegistry; use smallvec::{SmallVec, smallvec}; use state::NostrRegistry; -use theme::ActiveTheme; +use theme::{ActiveTheme, button_radius, panel_radius}; use ui::avatar::Avatar; use ui::button::{Button, ButtonVariants}; use ui::dock::{Panel, PanelEvent}; @@ -233,8 +233,8 @@ impl ContactListPanel { .h_8() .px_2() .justify_between() - .rounded(cx.theme().radius) - .hover(|this| this.bg(cx.theme().ghost_element_hover)) + .rounded(px(button_radius())) + .hover(|this| this.bg(cx.theme().element_hover)) .child( h_flex() .gap_2() @@ -273,7 +273,7 @@ impl ContactListPanel { .border_2() .border_dashed() .border_color(cx.theme().border) - .rounded(cx.theme().radius_lg) + .rounded(px(panel_radius())) .text_sm() .text_align(TextAlign::Center) .child(SharedString::from("Please add some relays.")) @@ -343,7 +343,7 @@ impl Render for ContactListPanel { div() .italic() .text_xs() - .text_color(cx.theme().text_danger) + .text_color(cx.theme().danger) .child(error.clone()), ) }), diff --git a/crates/workspace/src/panels/greeter.rs b/crates/workspace/src/panels/greeter.rs index 23f4acb1..88f22a38 100644 --- a/crates/workspace/src/panels/greeter.rs +++ b/crates/workspace/src/panels/greeter.rs @@ -91,7 +91,7 @@ impl Render for GreeterPanel { svg() .path("brand/coop.svg") .size_12() - .text_color(cx.theme().icon_muted), + .text_color(cx.theme().text_faint), ) .child( v_flex() diff --git a/crates/workspace/src/panels/inbox.rs b/crates/workspace/src/panels/inbox.rs index 84d83b8e..8e4180c3 100644 --- a/crates/workspace/src/panels/inbox.rs +++ b/crates/workspace/src/panels/inbox.rs @@ -35,7 +35,7 @@ impl Panel for InboxPanel { .child( Icon::new(IconName::Inbox) .small() - .text_color(cx.theme().icon_muted), + .text_color(cx.theme().text_faint), ) .child(self.name.clone()) .into_any_element() diff --git a/crates/workspace/src/sidebar/group_view.rs b/crates/workspace/src/sidebar/group_view.rs index 19d5b38e..8e951c47 100644 --- a/crates/workspace/src/sidebar/group_view.rs +++ b/crates/workspace/src/sidebar/group_view.rs @@ -230,10 +230,10 @@ impl Sidebar { Nav::new(label) .label(label) - .suffix(Icon::new(icon).small().text_color(cx.theme().icon_muted)) + .suffix(Icon::new(icon).small().text_color(cx.theme().text_faint)) .text_xs() .font_semibold() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .on_click(cx.listener(move |this, _event, _window, cx| { match section { GroupSection::Admins => this.admins_open = !this.admins_open, @@ -278,7 +278,7 @@ impl Sidebar { div() .truncate() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(SharedString::from(roles.join(", "))), ) }) diff --git a/crates/workspace/src/sidebar/inbox.rs b/crates/workspace/src/sidebar/inbox.rs index 649d9769..efca5d70 100644 --- a/crates/workspace/src/sidebar/inbox.rs +++ b/crates/workspace/src/sidebar/inbox.rs @@ -192,7 +192,7 @@ impl Sidebar { .px_4() .border_t_1() .border_color(cx.theme().border) - .bg(cx.theme().background) + .bg(cx.theme().bg) .child( Button::new("create-chat") .label(if self.selected_contacts.len() > 1 { diff --git a/crates/workspace/src/sidebar/list.rs b/crates/workspace/src/sidebar/list.rs index d8c8acf2..73bef958 100644 --- a/crates/workspace/src/sidebar/list.rs +++ b/crates/workspace/src/sidebar/list.rs @@ -8,7 +8,7 @@ use gpui::{ }; use nip29::GroupsRegistry; use settings::AppSettings; -use theme::ActiveTheme; +use theme::{ActiveTheme, control_radius}; use ui::nav_item::NavItem; use ui::scroll::Scrollbar; use ui::{Icon, IconName, Sizable, StyledExt, h_flex, v_flex}; @@ -88,31 +88,27 @@ impl Sidebar { .text_size(px(10.)) .text_color(cx.theme().text_muted) .text_center() - .rounded(cx.theme().radius) - .bg(cx.theme().elevated_surface_background) + .rounded(px(control_radius())) + .bg(cx.theme().surface_raised) .child(SharedString::from( request_count.to_string(), )), ) .when(self.new_requests && !requests_open, |this| { this.child( - div().size_1().rounded_full().bg(cx.theme().cursor), + div().size_1().rounded_full().bg(cx.theme().accent), ) }), ) }) - .when(requests_open, |this| { - this.bg(cx.theme().ghost_element_active) - }) + .when(requests_open, |this| this.bg(cx.theme().element_active)) .on_click(cx.listener(|this, _event, _window, cx| { this.toggle_requests(cx); })), ) .child( NavItem::new("contacts", "Contacts", Icon::new(IconName::Book).small()) - .when(contacts_open, |this| { - this.bg(cx.theme().ghost_element_active) - }) + .when(contacts_open, |this| this.bg(cx.theme().element_active)) .on_click(cx.listener(|this, _event, window, cx| { this.toggle_contacts(window, cx); })), @@ -124,7 +120,7 @@ impl Sidebar { .px_4() .text_xs() .font_semibold() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(list_title), ) }) diff --git a/crates/workspace/src/sidebar/mod.rs b/crates/workspace/src/sidebar/mod.rs index e7fa4d15..eaa22e7b 100644 --- a/crates/workspace/src/sidebar/mod.rs +++ b/crates/workspace/src/sidebar/mod.rs @@ -277,7 +277,7 @@ impl Render for Sidebar { .size_full() .relative() .gap_2() - .bg(cx.theme().surface_background) + .bg(cx.theme().surface) .when_some(current_user.as_ref(), |this, current_user| { this.child(title_bar_drag_handlers( self.render_user(current_user, cx), @@ -330,13 +330,13 @@ impl Render for Sidebar { .w_full() .h_9() .justify_center() - .bg(cx.theme().background.opacity(0.85)) + .bg(cx.theme().bg.opacity(0.85)) .when(cx.theme().shadow, |this| this.shadow_md()) .rounded_full() .text_xs() .font_semibold() .text_color(cx.theme().text_muted) - .child(Indicator::new().small().color(cx.theme().icon_accent)) + .child(Indicator::new().small().color(cx.theme().accent)) .child("Getting messages..."), ), ) diff --git a/crates/workspace/src/sidebar/rows.rs b/crates/workspace/src/sidebar/rows.rs index 7fc64d65..2dd32202 100644 --- a/crates/workspace/src/sidebar/rows.rs +++ b/crates/workspace/src/sidebar/rows.rs @@ -5,13 +5,13 @@ use common::TimestampExt; use gpui::prelude::FluentBuilder; use gpui::{ AnyElement, App, Context, Entity, IntoElement, ParentElement, SharedString, Styled, WeakEntity, - Window, div, + Window, div, px, }; use nip29::Group; use nostr_sdk::prelude::*; use person::PersonRegistry; use settings::AppSettings; -use theme::ActiveTheme; +use theme::{ActiveTheme, button_radius}; use ui::avatar::Avatar; use ui::dialog::DialogButtonProps; use ui::dock::{ClosePanel, DockArea, DockPlacement, PanelHandle}; @@ -89,10 +89,10 @@ impl Sidebar { Nav::new(label) .label(label) - .suffix(Icon::new(icon).small().text_color(cx.theme().icon_muted)) + .suffix(Icon::new(icon).small().text_color(cx.theme().text_faint)) .text_xs() .font_semibold() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .on_click(cx.listener(move |this, _event, _window, cx| { match section { ListSection::Pins => this.pins_open = !this.pins_open, @@ -114,7 +114,7 @@ impl Sidebar { .label(label) .text_xs() .font_semibold() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .into_any_element() } SidebarRow::Empty(text) => v_flex() @@ -130,9 +130,9 @@ impl Sidebar { .border_1() .border_dashed() .border_color(cx.theme().border) - .rounded(cx.theme().radius) + .rounded(px(button_radius())) .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(*text), ) .into_any_element(), @@ -162,7 +162,7 @@ impl Sidebar { div() .font_normal() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(created_at), ) .on_click(move |_event, window, cx| { @@ -279,7 +279,7 @@ impl Sidebar { div() .font_normal() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(suffix), ) }) @@ -353,7 +353,7 @@ impl Sidebar { div() .font_normal() .text_xs() - .text_color(cx.theme().text_placeholder) + .text_color(cx.theme().text_faint) .child(detail), ) .on_click(move |_event, window, cx| { diff --git a/crates/workspace/src/sidebar/search.rs b/crates/workspace/src/sidebar/search.rs index 5724ce1d..9ba0830b 100644 --- a/crates/workspace/src/sidebar/search.rs +++ b/crates/workspace/src/sidebar/search.rs @@ -4,12 +4,12 @@ use std::rc::Rc; use chat::{ChatRegistry, Room}; use gpui::{ AnyElement, App, Context, Entity, IntoElement, ParentElement, SharedString, Styled, Task, - Window, div, uniform_list, + Window, div, px, uniform_list, }; use nip29::{Group, GroupsRegistry}; use nostr_sdk::prelude::*; use state::{FIND_LIMIT, NostrRegistry}; -use theme::ActiveTheme; +use theme::{ActiveTheme, button_radius}; use ui::button::{Button, ButtonVariants}; use ui::input::Input; use ui::scroll::Scrollbar; @@ -201,8 +201,8 @@ impl Sidebar { .px_1p5() .gap_1() .w_full() - .rounded(cx.theme().radius) - .bg(cx.theme().elevated_surface_background) + .rounded(px(button_radius())) + .bg(cx.theme().surface_raised) .child( Input::new(&self.find_input) .appearance(false) diff --git a/docs/ui-theme-bezel-migration.md b/docs/ui-theme-bezel-migration.md index e870e47e..835f5796 100644 --- a/docs/ui-theme-bezel-migration.md +++ b/docs/ui-theme-bezel-migration.md @@ -439,20 +439,43 @@ should follow: exact semantics (`danger` wash source, `danger_muted` ink, `danger_strong` plate). -- [ ] `crates/chat_ui` (largest: ~200 sites) — chips and rows on - `elevated_surface_background` review to `surface_raised` vs - `surface_card`; reactions/toggles to `element_*`; report banners to - `warning_muted`/`danger_muted`. -- [ ] `crates/workspace` — tabs, dock, settings dialog, theme picker. - Note: the settings dialog's Light/Dark buttons call `Theme::change` - directly; they should move to `AppExt::set_appearance_mode` (and gain a - System option) in Phase 4. -- [ ] `crates/nip29_ui`, `crates/settings`, `crates/nip4e`, `desktop`, `web`. -- [ ] Replace `radius`/`radius_lg` with the ratio function the element is - (control inside control → 0.75x, control → 1x, card → 1.25x, floating → - 1.5x, bubble → 2x). This is the judgment-heavy step; do it per crate, - not with sed. -- [ ] `cargo check --workspace` clean; `grep -rn "theme().\(element\|secondary\|ghost_element\|tab_\|icon\|warning_\|danger_\|title_bar\|window_border\|panel_background\|surface_background\|elevated\)"` returns nothing. +- [x] `crates/chat_ui` — all 20 legacy tokens migrated in `lib.rs` (~46 + sites). Radius rulings: message media images → `bubble_radius()`; + reaction/file chips and composer tiles → `control_radius()`; trace + callout → `panel_radius()`; warning/danger report strips and the + floating hover toolbar → `surface_radius()`. `elevated_surface` + split: relay chips / reply-row hover → `surface_raised`, success + report box → `surface_card`. Warning sites got the bezel strip + treatment (`warning_muted` wash + `warning` ink); failed-report rows + got the error-strip recipe (`danger` @6% + `danger_muted` @90%). +- [x] `crates/workspace` — 58 sites across 18 files. Radius: warning + strips → `surface_radius()`; input plates and control rows → + `button_radius()`; request-count chip → `control_radius()`; browse + cards and empty states → `panel_radius()`. `text_danger` → `danger` + everywhere (each site was its view's only error signal). The "new + requests" bead in the sidebar (old `cursor` token, an accent blue) + → `accent`, not `caret` — it is an attention marker, not a text + cursor. Settings dialog's `Theme::change` calls left for Phase 4. +- [x] `crates/nip29_ui`, `crates/nip4e` — 27 sites. Activity-row hover → + `element_hover` (it interleaves with `MessageRow` in one list); + message media → `bubble_radius()`; chips/pills → `control_radius()`; + nip4e plates → `surface_card`. Flag for the design pass: the pin + chip now paints `solid` under a `text_muted` label — that pairing + predates the migration (old `element_background` + `text_muted`); + if it reads loud, its label should become `on_solid`. +- [x] `crates/settings`, `desktop`, `web` — verified zero theme-token + reads (their appearance wiring is Phase 4 scope). +- [x] Replace `radius`/`radius_lg` with the ratio function the element is + — done per crate by the agents above (not sed); rulings recorded + per bullet. +- [x] `cargo check --workspace` clean; the Phase 3 grep gate (extended + with `surface_background`, `background`, `cursor`, `drop_target_background`) + returns nothing across crates and `desktop`/`web`. + +Follow-ups noted: chat_ui paints delivery/status marks with hardcoded +`gpui::green()`/`red()` — candidates for the `success`/`busy`/`danger` +status-dot recipe in a later polish pass; warning strips carry no 20%-alpha +ring (no border existed; adding one is a structure change). ### Phase 4 — Settings, registry, shipped themes