Unify icons using multiple variants, remove all unused icons (#2974)

There are around ~400 icons in the `assets/icons` folder, but in reality
including file icons we only use around 50. In a number of places we use
different variants of the same icon, even in different styles.

This PR unifies the icons we use, removes the duplicates, and cleans out
unused icons.

Release Notes:

- Made icons more consistent throughout the app.
This commit is contained in:
Nate Butler
2023-09-15 13:55:13 -04:00
committed by GitHub
517 changed files with 95 additions and 4042 deletions
@@ -16,8 +16,8 @@ use workspace::{item::ItemHandle, StatusItemView, Workspace};
actions!(lsp_status, [ShowErrorMessage]);
const DOWNLOAD_ICON: &str = "icons/download_12.svg";
const WARNING_ICON: &str = "icons/triangle_exclamation_12.svg";
const DOWNLOAD_ICON: &str = "icons/download.svg";
const WARNING_ICON: &str = "icons/warning.svg";
pub enum Event {
ShowError { lsp_name: Arc<str>, error: String },
+2 -2
View File
@@ -2376,7 +2376,7 @@ impl ConversationEditor {
.with_children(
if let MessageStatus::Error(error) = &message.status {
Some(
Svg::new("icons/circle_x_mark_12.svg")
Svg::new("icons/error.svg")
.with_color(style.error_icon.color)
.constrained()
.with_width(style.error_icon.width)
@@ -2704,7 +2704,7 @@ impl View for InlineAssistant {
)
.with_children(if let Some(error) = self.codegen.read(cx).error() {
Some(
Svg::new("icons/circle_x_mark_12.svg")
Svg::new("icons/error.svg")
.with_color(theme.assistant.error_icon.color)
.constrained()
.with_width(theme.assistant.error_icon.width)
@@ -50,7 +50,7 @@ impl View for UpdateNotification {
.with_child(
MouseEventHandler::new::<Cancel, _>(0, cx, |state, _| {
let style = theme.dismiss_button.style_for(state);
Svg::new("icons/x_mark_8.svg")
Svg::new("icons/x.svg")
.with_color(style.color)
.constrained()
.with_width(style.icon_width)
+2 -2
View File
@@ -1249,7 +1249,7 @@ impl CollabPanel {
.collab_panel
.add_contact_button
.style_for(is_selected, state),
"icons/plus_16.svg",
"icons/plus.svg",
)
})
.with_cursor_style(CursorStyle::PointingHand)
@@ -1668,7 +1668,7 @@ impl CollabPanel {
cx.font_cache(),
))
.with_child(
Svg::new("icons/radix/file.svg")
Svg::new("icons/file.svg")
.with_color(theme.channel_hash.color)
.constrained()
.with_width(theme.channel_hash.width)
@@ -211,7 +211,7 @@ impl PickerDelegate for ContactFinderDelegate {
ContactRequestStatus::None | ContactRequestStatus::RequestReceived => {
Some("icons/check_8.svg")
}
ContactRequestStatus::RequestSent => Some("icons/x_mark_8.svg"),
ContactRequestStatus::RequestSent => Some("icons/x.svg"),
ContactRequestStatus::RequestAccepted => None,
};
let button_style = if self.user_store.read(cx).is_contact_request_pending(user) {
+9 -9
View File
@@ -483,10 +483,10 @@ impl CollabTitlebarItem {
let icon;
let tooltip;
if room.read(cx).is_screen_sharing() {
icon = "icons/radix/desktop.svg";
icon = "icons/desktop.svg";
tooltip = "Stop Sharing Screen"
} else {
icon = "icons/radix/desktop.svg";
icon = "icons/desktop.svg";
tooltip = "Share Screen";
}
@@ -533,10 +533,10 @@ impl CollabTitlebarItem {
let tooltip;
let is_muted = room.read(cx).is_muted(cx);
if is_muted {
icon = "icons/radix/mic-mute.svg";
icon = "icons/mic-mute.svg";
tooltip = "Unmute microphone";
} else {
icon = "icons/radix/mic.svg";
icon = "icons/mic.svg";
tooltip = "Mute microphone";
}
@@ -586,10 +586,10 @@ impl CollabTitlebarItem {
let tooltip;
let is_deafened = room.read(cx).is_deafened().unwrap_or(false);
if is_deafened {
icon = "icons/radix/speaker-off.svg";
icon = "icons/speaker-off.svg";
tooltip = "Unmute speakers";
} else {
icon = "icons/radix/speaker-loud.svg";
icon = "icons/speaker-loud.svg";
tooltip = "Mute speakers";
}
@@ -625,7 +625,7 @@ impl CollabTitlebarItem {
.into_any()
}
fn render_leave_call(&self, theme: &Theme, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
let icon = "icons/radix/exit.svg";
let icon = "icons/exit.svg";
let tooltip = "Leave call";
let titlebar = &theme.titlebar;
@@ -748,7 +748,7 @@ impl CollabTitlebarItem {
dropdown
.with_child(
Svg::new("icons/caret_down_8.svg")
Svg::new("icons/caret_down.svg")
.with_color(user_menu_button_style.icon.color)
.constrained()
.with_width(user_menu_button_style.icon.width)
@@ -1116,7 +1116,7 @@ impl CollabTitlebarItem {
| client::Status::Reauthenticating { .. }
| client::Status::Reconnecting { .. }
| client::Status::ReconnectionError { .. } => Some(
Svg::new("icons/cloud_slash_12.svg")
Svg::new("icons/disconnected.svg")
.with_color(theme.titlebar.offline_icon.color)
.constrained()
.with_width(theme.titlebar.offline_icon.width)
+1 -1
View File
@@ -53,7 +53,7 @@ where
.with_child(
MouseEventHandler::new::<Dismiss, _>(user.id as usize, cx, |state, _| {
let style = theme.dismiss_button.style_for(state);
Svg::new("icons/x_mark_8.svg")
Svg::new("icons/x.svg")
.with_color(style.color)
.constrained()
.with_width(style.icon_width)
+4 -4
View File
@@ -78,15 +78,15 @@ impl View for CopilotButton {
.with_child(
Svg::new({
match status {
Status::Error(_) => "icons/copilot_error_16.svg",
Status::Error(_) => "icons/copilot_error.svg",
Status::Authorized => {
if enabled {
"icons/copilot_16.svg"
"icons/copilot.svg"
} else {
"icons/copilot_disabled_16.svg"
"icons/copilot_disabled.svg"
}
}
_ => "icons/copilot_init_16.svg",
_ => "icons/copilot_init.svg",
}
})
.with_color(style.icon_color)
+4 -6
View File
@@ -686,11 +686,9 @@ fn diagnostic_header_renderer(diagnostic: Diagnostic) -> RenderBlock {
let font_size = (style.text_scale_factor * settings.buffer_font_size(cx)).round();
let icon_width = cx.em_width * style.icon_width_factor;
let icon = if diagnostic.severity == DiagnosticSeverity::ERROR {
Svg::new("icons/circle_x_mark_12.svg")
.with_color(theme.error_diagnostic.message.text.color)
Svg::new("icons/error.svg").with_color(theme.error_diagnostic.message.text.color)
} else {
Svg::new("icons/triangle_exclamation_12.svg")
.with_color(theme.warning_diagnostic.message.text.color)
Svg::new("icons/warning.svg").with_color(theme.warning_diagnostic.message.text.color)
};
Flex::row()
@@ -748,7 +746,7 @@ pub(crate) fn render_summary<T: 'static>(
let summary_spacing = theme.tab_summary_spacing;
Flex::row()
.with_child(
Svg::new("icons/circle_x_mark_12.svg")
Svg::new("icons/error.svg")
.with_color(text_style.color)
.constrained()
.with_width(icon_width)
@@ -767,7 +765,7 @@ pub(crate) fn render_summary<T: 'static>(
.aligned(),
)
.with_child(
Svg::new("icons/triangle_exclamation_12.svg")
Svg::new("icons/warning.svg")
.with_color(text_style.color)
.constrained()
.with_width(icon_width)
+1 -1
View File
@@ -3827,7 +3827,7 @@ impl Editor {
enum CodeActions {}
Some(
MouseEventHandler::new::<CodeActions, _>(0, cx, |state, _| {
Svg::new("icons/bolt_8.svg").with_color(
Svg::new("icons/bolt.svg").with_color(
style
.code_actions
.indicator
+1 -1
View File
@@ -1735,7 +1735,7 @@ impl EditorElement {
enum JumpIcon {}
MouseEventHandler::new::<JumpIcon, _>((*id).into(), cx, |state, _| {
let style = style.jump_icon.style_for(state);
Svg::new("icons/arrow_up_right_8.svg")
Svg::new("icons/arrow_up_right.svg")
.with_color(style.color)
.constrained()
.with_width(style.icon_width)
+1 -1
View File
@@ -276,7 +276,7 @@ impl Item for FeedbackEditor {
) -> AnyElement<T> {
Flex::row()
.with_child(
Svg::new("icons/feedback_16.svg")
Svg::new("icons/feedback.svg")
.with_color(style.label.text.color)
.constrained()
.with_width(style.type_icon_width)
@@ -94,7 +94,7 @@ impl View for QuickActionBar {
bar.add_child(render_quick_action_bar_button(
2,
"icons/radix/magic-wand.svg",
"icons/magic-wand.svg",
false,
("Inline Assist".into(), Some(Box::new(InlineAssist))),
cx,
+4 -4
View File
@@ -511,7 +511,7 @@ impl Item for ProjectSearchView {
) -> AnyElement<T> {
Flex::row()
.with_child(
Svg::new("icons/magnifying_glass_12.svg")
Svg::new("icons/magnifying_glass.svg")
.with_color(tab_theme.label.text.color)
.constrained()
.with_width(tab_theme.type_icon_width)
@@ -1440,7 +1440,7 @@ impl View for ProjectSearchBar {
let search = _search.read(cx);
let filter_button = render_option_button_icon(
search.filters_enabled,
"icons/filter_12.svg",
"icons/filter.svg",
0,
"Toggle filters",
Box::new(ToggleFilters),
@@ -1471,14 +1471,14 @@ impl View for ProjectSearchBar {
};
let case_sensitive = is_semantic_disabled.then(|| {
render_option_button_icon(
"icons/case_insensitive_12.svg",
"icons/case_insensitive.svg",
SearchOptions::CASE_SENSITIVE,
cx,
)
});
let whole_word = is_semantic_disabled.then(|| {
render_option_button_icon("icons/word_search_12.svg", SearchOptions::WHOLE_WORD, cx)
render_option_button_icon("icons/word_search.svg", SearchOptions::WHOLE_WORD, cx)
});
let search_button_for_mode = |mode, side, cx: &mut ViewContext<ProjectSearchBar>| {
+2 -2
View File
@@ -63,8 +63,8 @@ impl SearchOptions {
pub fn icon(&self) -> &'static str {
match *self {
SearchOptions::WHOLE_WORD => "icons/word_search_12.svg",
SearchOptions::CASE_SENSITIVE => "icons/case_insensitive_12.svg",
SearchOptions::WHOLE_WORD => "icons/word_search.svg",
SearchOptions::CASE_SENSITIVE => "icons/case_insensitive.svg",
_ => panic!("{:?} is not a named SearchOption", self),
}
}
+2 -2
View File
@@ -132,9 +132,9 @@ impl<V: 'static> CollabPanelElement<V> {
div().flex().h_full().gap_1().items_center().child(
svg()
.path(if expanded {
"icons/radix/caret-down.svg"
"icons/caret_down.svg"
} else {
"icons/radix/caret-up.svg"
"icons/caret_up.svg"
})
.w_3p5()
.h_3p5()
+3 -3
View File
@@ -217,7 +217,7 @@ impl TitleBar {
.fill(theme.lowest.base.pressed.background)
.child(
svg()
.path("icons/radix/speaker-loud.svg")
.path("icons/speaker-loud.svg")
.size_3p5()
.fill(theme.lowest.base.default.foreground),
),
@@ -237,7 +237,7 @@ impl TitleBar {
.fill(theme.lowest.base.pressed.background)
.child(
svg()
.path("icons/radix/desktop.svg")
.path("icons/desktop.svg")
.size_3p5()
.fill(theme.lowest.base.default.foreground),
),
@@ -269,7 +269,7 @@ impl TitleBar {
)
.child(
svg()
.path("icons/caret_down_8.svg")
.path("icons/caret_down.svg")
.w_2()
.h_2()
.fill(theme.lowest.variant.default.foreground),
+3 -3
View File
@@ -70,7 +70,7 @@ impl TerminalPanel {
Flex::row()
.with_child(Pane::render_tab_bar_button(
0,
"icons/plus_12.svg",
"icons/plus.svg",
false,
Some(("New Terminal", Some(Box::new(workspace::NewTerminal)))),
cx,
@@ -90,9 +90,9 @@ impl TerminalPanel {
.with_child(Pane::render_tab_bar_button(
1,
if pane.is_zoomed() {
"icons/minimize_8.svg"
"icons/minimize.svg"
} else {
"icons/maximize_8.svg"
"icons/maximize.svg"
},
pane.is_zoomed(),
Some(("Toggle Zoom".into(), Some(Box::new(workspace::ToggleZoom)))),
+1 -1
View File
@@ -292,7 +292,7 @@ pub mod simple_message_notification {
.with_child(
MouseEventHandler::new::<Cancel, _>(0, cx, |state, _| {
let style = theme.dismiss_button.style_for(state);
Svg::new("icons/x_mark_8.svg")
Svg::new("icons/x.svg")
.with_color(style.color)
.constrained()
.with_width(style.icon_width)
+7 -7
View File
@@ -337,7 +337,7 @@ impl Pane {
// New menu
.with_child(Self::render_tab_bar_button(
0,
"icons/plus_12.svg",
"icons/plus.svg",
false,
Some(("New...".into(), None)),
cx,
@@ -352,7 +352,7 @@ impl Pane {
))
.with_child(Self::render_tab_bar_button(
1,
"icons/split_12.svg",
"icons/split.svg",
false,
Some(("Split Pane".into(), None)),
cx,
@@ -369,10 +369,10 @@ impl Pane {
let icon_path;
let tooltip_label;
if pane.is_zoomed() {
icon_path = "icons/minimize_8.svg";
icon_path = "icons/minimize.svg";
tooltip_label = "Zoom In";
} else {
icon_path = "icons/maximize_8.svg";
icon_path = "icons/maximize.svg";
tooltip_label = "Zoom In";
}
@@ -1535,7 +1535,7 @@ impl Pane {
let close_element = if hovered {
let item_id = item.id();
enum TabCloseButton {}
let icon = Svg::new("icons/x_mark_8.svg");
let icon = Svg::new("icons/x.svg");
MouseEventHandler::new::<TabCloseButton, _>(item_id, cx, |mouse_state, _| {
if mouse_state.hovered() {
icon.with_color(tab_style.icon_close_active)
@@ -1701,7 +1701,7 @@ impl View for Pane {
let mut tab_row = Flex::row()
.with_child(nav_button(
"icons/arrow_left_16.svg",
"icons/arrow_left.svg",
button_style.clone(),
nav_button_height,
tooltip_style.clone(),
@@ -1726,7 +1726,7 @@ impl View for Pane {
))
.with_child(
nav_button(
"icons/arrow_right_16.svg",
"icons/arrow_right.svg",
button_style.clone(),
nav_button_height,
tooltip_style,