Skip to main content

euv_ui/component/icon/view/
impl.rs

1use super::*;
2
3/// Inherent implementation of [`EuvIconSize`].
4impl EuvIconSize {
5    /// Returns the glyph edge length in pixels for this size.
6    ///
7    /// # Returns
8    ///
9    /// - `i32` - The edge length in pixels: 12 for `Xs`, 16 for `Sm`, 20 for
10    ///   `Md`, 24 for `Lg`, 32 for `Xl`.
11    pub fn px(&self) -> i32 {
12        match self {
13            EuvIconSize::Xs => 12,
14            EuvIconSize::Sm => 16,
15            EuvIconSize::Md => 20,
16            EuvIconSize::Lg => 24,
17            EuvIconSize::Xl => 32,
18        }
19    }
20}