use gpui::{Styled, svg}; use paste::paste; use crate::app; macro_rules! define_font_icons { ($($name:ident),+ $(,)?) => { paste! { #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] pub enum FontIcon { $($name),+ } pub const fn icon_path(icon: FontIcon) -> &'static str { match icon { $( FontIcon::$name => concat!( "asset/font_icon/", stringify!([<$name:snake>]), ".svg" ), )+ } } } }; } define_font_icons!(ChevronDown, FolderGit, Github); pub fn font_icon(icon: FontIcon, cx: &gpui::Context) -> gpui::Svg { let theme = cx.global::().current_theme; println!("{}", icon_path(icon)); svg().path(icon_path(icon)).text_color(theme.colors.text) }