Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Revert "remove usages of `theme::color_alpha`"
Nate Butlera35b73e63e2b
diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rsindex 6e0ff77ef28..b682bfdccab 100644--- a/crates/assistant/src/assistant_panel.rs+++ b/crates/assistant/src/assistant_panel.rs@@ -2625,8 +2625,8 @@ impl ContextEditor {.px_1().mr_0p5().border_1()- .border_color(colors.border_variant.opacity(0.6))- .bg(colors.element_background.opacity(0.6))+ .border_color(theme::color_alpha(colors.border_variant, 0.6))+ .bg(theme::color_alpha(colors.element_background, 0.6)).child("esc"),).child("to cancel")diff --git a/crates/extensions_ui/src/components/extension_card.rs b/crates/extensions_ui/src/components/extension_card.rsindex c44ac2063a0..2dc472f801a 100644--- a/crates/extensions_ui/src/components/extension_card.rs+++ b/crates/extensions_ui/src/components/extension_card.rs@@ -52,7 +52,10 @@ impl RenderOnce for ExtensionCard {.size_full().items_center().justify_center()- .bg(cx.theme().colors().elevated_surface_background.opacity(0.8))+ .bg(theme::color_alpha(+ cx.theme().colors().elevated_surface_background,+ 0.8,+ )).child(Label::new("Overridden by dev extension.")),)}),diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rsindex e6ba24f75cc..154b9297a39 100644--- a/crates/outline/src/outline.rs+++ b/crates/outline/src/outline.rs@@ -17,7 +17,7 @@ use language::{Outline, OutlineItem};use ordered_float::OrderedFloat;use picker::{Picker, PickerDelegate};use settings::Settings;-use theme::{ActiveTheme, ThemeSettings};+use theme::{color_alpha, ActiveTheme, ThemeSettings};use ui::{prelude::*, ListItem, ListItemSpacing};use util::ResultExt;use workspace::{DismissDecision, ModalView};@@ -297,7 +297,7 @@ pub fn render_item<T>(cx: &AppContext,) -> StyledText {let highlight_style = HighlightStyle {- background_color: Some(cx.theme().colors().text_accent.opacity(0.3)),+ background_color: Some(color_alpha(cx.theme().colors().text_accent, 0.3)),..Default::default()};let custom_highlights = match_rangesdiff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rsindex d501d3c1186..cf860ad452d 100644--- a/crates/theme/src/theme.rs+++ b/crates/theme/src/theme.rs@@ -333,6 +333,14 @@ impl Theme {}}+/// Compounds a color with an alpha value.+/// TODO: Replace this with a method on Hsla.+pub fn color_alpha(color: Hsla, alpha: f32) -> Hsla {+ let mut color = color;+ color.a = alpha;+ color+}+/// Asynchronously reads the user theme from the specified path.pub async fn read_user_theme(theme_path: &Path, fs: Arc<dyn Fs>) -> Result<ThemeFamilyContent> {let reader = fs.open_sync(theme_path).await?;