remove usages of `theme::color_alpha`

Nate Butler created

Change summary

crates/assistant/src/assistant_panel.rs               | 4 ++--
crates/extensions_ui/src/components/extension_card.rs | 5 +----
crates/outline/src/outline.rs                         | 4 ++--
crates/theme/src/theme.rs                             | 8 --------
4 files changed, 5 insertions(+), 16 deletions(-)

Detailed changes

crates/assistant/src/assistant_panel.rs 🔗

@@ -2625,8 +2625,8 @@ impl ContextEditor {
                     .px_1()
                     .mr_0p5()
                     .border_1()
-                    .border_color(theme::color_alpha(colors.border_variant, 0.6))
-                    .bg(theme::color_alpha(colors.element_background, 0.6))
+                    .border_color(colors.border_variant.opacity(0.6))
+                    .bg(colors.element_background.opacity(0.6))
                     .child("esc"),
             )
             .child("to cancel")

crates/extensions_ui/src/components/extension_card.rs 🔗

@@ -52,10 +52,7 @@ impl RenderOnce for ExtensionCard {
                             .size_full()
                             .items_center()
                             .justify_center()
-                            .bg(theme::color_alpha(
-                                cx.theme().colors().elevated_surface_background,
-                                0.8,
-                            ))
+                            .bg(cx.theme().colors().elevated_surface_background.opacity(0.8))
                             .child(Label::new("Overridden by dev extension.")),
                     )
                 }),

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::{color_alpha, ActiveTheme, ThemeSettings};
+use theme::{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(color_alpha(cx.theme().colors().text_accent, 0.3)),
+        background_color: Some(cx.theme().colors().text_accent.opacity(0.3)),
         ..Default::default()
     };
     let custom_highlights = match_ranges

crates/theme/src/theme.rs 🔗

@@ -333,14 +333,6 @@ 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?;