Skip to main content

egui_charts/ui/icons/
mod.rs

1//! Icon size presets.
2
3use crate::tokens::DESIGN_TOKENS;
4
5/// Icon size presets
6#[derive(Clone, Copy, Debug, PartialEq)]
7pub enum IconSize {
8    /// Small icon preset.
9    Small,
10    /// Medium icon preset.
11    Medium,
12    /// Large icon preset.
13    Large,
14    /// Extra-large icon preset.
15    XLarge,
16}
17
18impl IconSize {
19    /// Icon side length in egui logical points.
20    pub fn size(&self) -> f32 {
21        match self {
22            IconSize::Small => DESIGN_TOKENS.sizing.icon_sm,
23            IconSize::Medium => DESIGN_TOKENS.sizing.technical_labels.elliott_label_size,
24            IconSize::Large => DESIGN_TOKENS.sizing.icon_lg,
25            IconSize::XLarge => DESIGN_TOKENS.sizing.icon_xxl,
26        }
27    }
28}