Skip to main content

orbital_shell/tokens/
material.rs

1//! Surface material (solid vs translucent).
2
3/// Material treatment for marketing and shell surfaces.
4#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
5pub enum Material {
6    /// Default — highest readability in dark mode.
7    Solid,
8    /// Top bar, transient popovers, coachmarks.
9    Frost,
10    /// Reserved for signed-in shells (not default on public marketing).
11    Shell,
12    /// Blocking scrim behind dialogs / blocking coachmarks.
13    Scrim,
14}
15
16impl Material {
17    #[allow(non_upper_case_globals)]
18    #[deprecated(note = "Renamed to Frost")]
19    pub const Acrylic: Self = Self::Frost;
20    #[allow(non_upper_case_globals)]
21    #[deprecated(note = "Renamed to Shell")]
22    pub const Mica: Self = Self::Shell;
23    #[allow(non_upper_case_globals)]
24    #[deprecated(note = "Renamed to Scrim")]
25    pub const Smoke: Self = Self::Scrim;
26
27    pub const fn as_class(self) -> &'static str {
28        match self {
29            Self::Solid => "orbital-token-material-solid",
30            Self::Frost => "orbital-token-material-frost",
31            Self::Shell => "orbital-token-material-shell",
32            Self::Scrim => "orbital-token-material-scrim",
33        }
34    }
35
36    /// CSS `backdrop-filter` / opacity hints; callers combine with elevation.
37    pub const fn as_token(self) -> &'static str {
38        match self {
39            Self::Solid => "none",
40            Self::Frost => "saturate(108%) blur(12px)",
41            Self::Shell => "saturate(128%) blur(16px)",
42            Self::Scrim => "none",
43        }
44    }
45}