remove usages of theme::color_alpha

This commit is contained in:
Nate Butler 2024-11-19 00:24:37 -05:00
parent 0e26d22fea
commit c0d11be75f
4 changed files with 5 additions and 16 deletions

View file

@ -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")

View file

@ -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.")),
)
}),

View file

@ -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

View file

@ -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?;