typography.rs

 1use gpui::{rems, Rems};
 2
 3#[derive(Debug, Default, Clone)]
 4pub enum UiTextSize {
 5    /// The default size for UI text.
 6    ///
 7    /// `0.825rem` or `14px` at the default scale of `1rem` = `16px`.
 8    ///
 9    /// Note: The absolute size of this text will change based on a user's `ui_scale` setting.
10    #[default]
11    Default,
12    /// The small size for UI text.
13    ///
14    /// `0.75rem` or `12px` at the default scale of `1rem` = `16px`.
15    ///
16    /// Note: The absolute size of this text will change based on a user's `ui_scale` setting.
17    Small,
18
19    /// The extra small size for UI text.
20    ///
21    /// `0.625rem` or `10px` at the default scale of `1rem` = `16px`.
22    ///
23    /// Note: The absolute size of this text will change based on a user's `ui_scale` setting.
24    XSmall,
25}
26
27impl UiTextSize {
28    pub fn rems(self) -> Rems {
29        match self {
30            Self::Default => rems(14. / 16.),
31            Self::Small => rems(12. / 16.),
32            Self::XSmall => rems(10. / 16.),
33        }
34    }
35}