1use gpui::{AnyElement, App, IntoElement, RenderOnce, SharedString, Styled, Window, svg};
2
3include!(concat!(env!("OUT_DIR"), "/icon_name.rs"));
4
5pub trait IconNamed {
8 fn path(self) -> SharedString;
9}
10
11impl IconNamed for IconName {
12 fn path(self) -> SharedString {
13 IconName::path(self)
14 }
15}
16
17impl RenderOnce for IconName {
20 fn render(self, window: &mut Window, _: &mut App) -> impl IntoElement {
21 let text_style = window.text_style();
22 svg()
23 .path(self.path())
24 .flex_shrink_0()
25 .size(text_style.font_size.to_pixels(window.rem_size()))
26 .text_color(text_style.color)
27 }
28}
29
30impl From<IconName> for AnyElement {
31 fn from(name: IconName) -> Self {
32 name.into_any_element()
33 }
34}