xtap_core_lib/ui/
icons.rs1use crate::ui::theme::UiTheme;
2
3pub struct IconMaster;
4
5impl IconMaster {
6 pub const ICON_SETTINGS: &'static str = "\u{f101}";
7 pub const ICON_USER: &'static str = "\u{f102}";
8 pub const ICON_SEARCH: &'static str = "\u{f103}";
9
10 pub fn get_icon_size() -> f32 {
11 UiTheme::ICON_SIZE
12 }
13}
14
15pub fn load_egui_icon_from_bytes(bytes: &[u8]) -> egui::IconData {
18 let img = image::load_from_memory(bytes).expect("Failed to decode icon image");
19 let rgba = img.to_rgba8();
20 let (w, h) = rgba.dimensions();
21 egui::IconData {
22 rgba: rgba.into_raw(),
23 width: w,
24 height: h,
25 }
26}