Combine LabelColor and IconColor into TextColor

This commit is contained in:
Marshall Bowers 2023-11-14 13:48:01 -05:00
parent dc56a7b12b
commit 76c15229c1
25 changed files with 152 additions and 220 deletions

View file

@ -1,7 +1,7 @@
use gpui::{Div, Render, View, VisualContext};
use crate::prelude::*;
use crate::{h_stack, Icon, IconButton, IconColor, Input};
use crate::{h_stack, Icon, IconButton, Input, TextColor};
#[derive(Clone)]
pub struct BufferSearch {
@ -36,7 +36,7 @@ impl Render for BufferSearch {
.child(
h_stack().child(Input::new("Search")).child(
IconButton::<Self>::new("replace", Icon::Replace)
.when(self.is_replace_open, |this| this.color(IconColor::Accent))
.when(self.is_replace_open, |this| this.color(TextColor::Accent))
.on_click(|buffer_search, cx| {
buffer_search.toggle_replace(cx);
}),

View file

@ -1,7 +1,7 @@
use chrono::NaiveDateTime;
use crate::prelude::*;
use crate::{Icon, IconButton, Input, Label, LabelColor};
use crate::{Icon, IconButton, Input, Label, TextColor};
#[derive(Component)]
pub struct ChatPanel {
@ -95,7 +95,7 @@ impl ChatMessage {
.child(Label::new(self.author.clone()))
.child(
Label::new(self.sent_at.format("%m/%d/%Y").to_string())
.color(LabelColor::Muted),
.color(TextColor::Muted),
),
)
.child(div().child(Label::new(self.text.clone())))

View file

@ -1,4 +1,4 @@
use crate::{prelude::*, Button, Label, LabelColor, Modal};
use crate::{prelude::*, Button, Label, Modal, TextColor};
#[derive(Component)]
pub struct CopilotModal {
@ -14,7 +14,7 @@ impl CopilotModal {
div().id(self.id.clone()).child(
Modal::new("some-id")
.title("Connect Copilot to Zed")
.child(Label::new("You can update your settings or sign out from the Copilot menu in the status bar.").color(LabelColor::Muted))
.child(Label::new("You can update your settings or sign out from the Copilot menu in the status bar.").color(TextColor::Muted))
.primary_action(Button::new("Connect to Github").variant(ButtonVariant::Filled)),
)
}

View file

@ -5,7 +5,7 @@ use gpui::{Div, Render, View, VisualContext};
use crate::prelude::*;
use crate::{
hello_world_rust_editor_with_status_example, v_stack, Breadcrumb, Buffer, BufferSearch, Icon,
IconButton, IconColor, Symbol, Tab, TabBar, Toolbar,
IconButton, Symbol, Tab, TabBar, TextColor, Toolbar,
};
#[derive(Clone)]
@ -63,7 +63,7 @@ impl Render for EditorPane {
IconButton::new("toggle_inlay_hints", Icon::InlayHint),
IconButton::<Self>::new("buffer_search", Icon::MagnifyingGlass)
.when(self.is_buffer_search_open, |this| {
this.color(IconColor::Accent)
this.color(TextColor::Accent)
})
.on_click(|editor, cx| {
editor.toggle_buffer_search(cx);

View file

@ -1,8 +1,8 @@
use crate::utils::naive_format_distance_from_now;
use crate::{
h_stack, prelude::*, static_new_notification_items_2, v_stack, Avatar, ButtonOrIconButton,
Icon, IconElement, Label, LabelColor, LineHeightStyle, ListHeaderMeta, ListSeparator,
PublicPlayer, UnreadIndicator,
Icon, IconElement, Label, LineHeightStyle, ListHeaderMeta, ListSeparator, PublicPlayer,
TextColor, UnreadIndicator,
};
use crate::{ClickHandler, ListHeader};
@ -48,7 +48,7 @@ impl NotificationsPanel {
.border_color(cx.theme().colors().border_variant)
.child(
Label::new("Search...")
.color(LabelColor::Placeholder)
.color(TextColor::Placeholder)
.line_height_style(LineHeightStyle::UILabel),
),
)
@ -252,7 +252,7 @@ impl<V> Notification<V> {
if let Some(icon) = icon {
meta_el = meta_el.child(IconElement::new(icon.clone()));
}
meta_el.child(Label::new(text.clone()).color(LabelColor::Muted))
meta_el.child(Label::new(text.clone()).color(TextColor::Muted))
})
.collect::<Vec<_>>(),
)
@ -311,7 +311,7 @@ impl<V> Notification<V> {
true,
true,
))
.color(LabelColor::Muted),
.color(TextColor::Muted),
)
.child(self.render_meta_items(cx)),
)
@ -321,11 +321,11 @@ impl<V> Notification<V> {
// Show the taken_message
(Some(_), Some(action_taken)) => h_stack()
.children(action_taken.taken_message.0.map(|icon| {
IconElement::new(icon).color(crate::IconColor::Muted)
IconElement::new(icon).color(crate::TextColor::Muted)
}))
.child(
Label::new(action_taken.taken_message.1.clone())
.color(LabelColor::Muted),
.color(TextColor::Muted),
),
// Show the actions
(Some(actions), None) => {

View file

@ -1,7 +1,7 @@
use std::sync::Arc;
use crate::prelude::*;
use crate::{Button, Icon, IconButton, IconColor, ToolDivider, Workspace};
use crate::{Button, Icon, IconButton, TextColor, ToolDivider, Workspace};
#[derive(Default, PartialEq)]
pub enum Tool {
@ -110,7 +110,7 @@ impl StatusBar {
.child(
IconButton::<Workspace>::new("project_panel", Icon::FileTree)
.when(workspace.is_project_panel_open(), |this| {
this.color(IconColor::Accent)
this.color(TextColor::Accent)
})
.on_click(|workspace, cx| {
workspace.toggle_project_panel(cx);
@ -119,7 +119,7 @@ impl StatusBar {
.child(
IconButton::<Workspace>::new("collab_panel", Icon::Hash)
.when(workspace.is_collab_panel_open(), |this| {
this.color(IconColor::Accent)
this.color(TextColor::Accent)
})
.on_click(|workspace, cx| {
workspace.toggle_collab_panel();
@ -174,7 +174,7 @@ impl StatusBar {
.child(
IconButton::<Workspace>::new("terminal", Icon::Terminal)
.when(workspace.is_terminal_open(), |this| {
this.color(IconColor::Accent)
this.color(TextColor::Accent)
})
.on_click(|workspace, cx| {
workspace.toggle_terminal(cx);
@ -183,7 +183,7 @@ impl StatusBar {
.child(
IconButton::<Workspace>::new("chat_panel", Icon::MessageBubbles)
.when(workspace.is_chat_panel_open(), |this| {
this.color(IconColor::Accent)
this.color(TextColor::Accent)
})
.on_click(|workspace, cx| {
workspace.toggle_chat_panel(cx);
@ -192,7 +192,7 @@ impl StatusBar {
.child(
IconButton::<Workspace>::new("assistant_panel", Icon::Ai)
.when(workspace.is_assistant_panel_open(), |this| {
this.color(IconColor::Accent)
this.color(TextColor::Accent)
})
.on_click(|workspace, cx| {
workspace.toggle_assistant_panel(cx);

View file

@ -6,8 +6,8 @@ use gpui::{Div, Render, View, VisualContext};
use crate::prelude::*;
use crate::settings::user_settings;
use crate::{
Avatar, Button, Icon, IconButton, IconColor, MicStatus, PlayerStack, PlayerWithCallStatus,
ScreenShareStatus, ToolDivider, TrafficLights,
Avatar, Button, Icon, IconButton, MicStatus, PlayerStack, PlayerWithCallStatus,
ScreenShareStatus, TextColor, ToolDivider, TrafficLights,
};
#[derive(Clone)]
@ -152,19 +152,19 @@ impl Render for TitleBar {
.gap_1()
.child(
IconButton::<TitleBar>::new("toggle_mic_status", Icon::Mic)
.when(self.is_mic_muted(), |this| this.color(IconColor::Error))
.when(self.is_mic_muted(), |this| this.color(TextColor::Error))
.on_click(|title_bar, cx| title_bar.toggle_mic_status(cx)),
)
.child(
IconButton::<TitleBar>::new("toggle_deafened", Icon::AudioOn)
.when(self.is_deafened, |this| this.color(IconColor::Error))
.when(self.is_deafened, |this| this.color(TextColor::Error))
.on_click(|title_bar, cx| title_bar.toggle_deafened(cx)),
)
.child(
IconButton::<TitleBar>::new("toggle_screen_share", Icon::Screen)
.when(
self.screen_share_status == ScreenShareStatus::Shared,
|this| this.color(IconColor::Accent),
|this| this.color(TextColor::Accent),
)
.on_click(|title_bar, cx| {
title_bar.toggle_screen_share_status(cx)