diff --git a/libraries/egui_extras/src/lib.rs b/libraries/egui_extras/src/lib.rs index 6a6161f..ffb9abd 100644 --- a/libraries/egui_extras/src/lib.rs +++ b/libraries/egui_extras/src/lib.rs @@ -29,3 +29,15 @@ pub mod visuals; pub mod build { include!(concat!(env!("OUT_DIR"), "/builders.rs")); } + +pub trait WithAlpha { + #[must_use] + fn with_alpha(self, alpha: u8) -> Self; +} +impl WithAlpha for egui::Color32 { + #[must_use] + fn with_alpha(self, alpha: u8) -> Self { + let [r, g, b, _] = self.to_srgba_unmultiplied(); + egui::Color32::from_rgba_unmultiplied(r, g, b, alpha) + } +} diff --git a/libraries/egui_extras/src/styles.rs b/libraries/egui_extras/src/styles.rs index 04f4514..03377f7 100644 --- a/libraries/egui_extras/src/styles.rs +++ b/libraries/egui_extras/src/styles.rs @@ -8,7 +8,7 @@ use std::sync::Arc; use eframe::{CreationContext, Frame, Storage}; -use egui::{Color32, Context, Style}; +use egui::{Context, Style}; /// /// Implementation of `eframe::App` that automatically saves the state of the @@ -45,15 +45,3 @@ impl eframe::App for StylePersistingApp { } } } - -pub trait WithAlpha { - #[must_use] - fn with_alpha(self, alpha: u8) -> Self; -} -impl WithAlpha for Color32 { - #[must_use] - fn with_alpha(self, alpha: u8) -> Self { - let [r, g, b, _] = self.to_srgba_unmultiplied(); - Color32::from_rgba_unmultiplied(r, g, b, alpha) - } -} diff --git a/libraries/egui_extras/src/visuals.rs b/libraries/egui_extras/src/visuals.rs index e63c020..3297060 100644 --- a/libraries/egui_extras/src/visuals.rs +++ b/libraries/egui_extras/src/visuals.rs @@ -2,7 +2,7 @@ // Copyright 2024 IROX Contributors // -use crate::styles::WithAlpha; +use crate::WithAlpha; use egui::color_picker::show_color; use egui::{vec2, RichText};