pub enum SurfaceRole {
None,
Panel,
Raised,
Sunken,
Popover,
Selected,
Current,
Input,
Danger,
}Expand description
Semantic paint role for rect-shaped surfaces.
Each variant maps to a theme-applied recipe at paint time. Roles are
either decorative (set stroke + shadow on top of whatever fill the
node already carries) or fill-providing (default a fill from the
palette when the node has none). The split matters: setting a
decorative role on a node with no fill produces an “invisible
surface” — only a thin border over the parent’s background. For
panel-shaped containers, prefer the dedicated widget (card(),
sidebar(), dialog(), popover()) which bundles role + fill +
stroke + radius + shadow correctly.
Variants§
None
No special semantic role. Theme fallback applies.
Panel
Decorative. Border + small drop shadow. Does not paint a
fill — the node must supply one (e.g. tokens::CARD) or sit
inside a widget like card() / sidebar() that does.
Raised
Decorative. Border + half-strength shadow, suggesting one
elevation step above its parent. Like Panel, no fill.
Sunken
Fill-providing. Slightly darker variant of MUTED (palette
darken(0.08)) with input-toned border. Use for inset bands —
search wells, segmented-control tracks, recessed list headers.
Popover
Decorative. Input-toned border + large drop shadow for
floating panels. Used by popover() and friends; bring your
own fill (typically tokens::POPOVER).
Selected
Fill-providing. PRIMARY-tinted alpha 28 fill +
PRIMARY-tinted alpha 110 border. The selected item inside a
collection. Prefer the .selected() chainable, which sets this
role plus content color in one call.
Current
Fill-providing. Solid ACCENT fill + neutral border for
the current page / nav item. Prefer the .current() chainable,
which also bumps font weight and content color.
Input
Fill-providing. Same recipe as Sunken — used by text
inputs and other editable surfaces.
Danger
Decorative. Destructive-toned border, no shadow. Pair with
a tint fill (e.g. tokens::DESTRUCTIVE.with_alpha(40)) for the
classic “danger” band in a form or section header.
Implementations§
Source§impl SurfaceRole
impl SurfaceRole
Trait Implementations§
Source§impl Clone for SurfaceRole
impl Clone for SurfaceRole
Source§fn clone(&self) -> SurfaceRole
fn clone(&self) -> SurfaceRole
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SurfaceRole
impl Debug for SurfaceRole
Source§impl Default for SurfaceRole
impl Default for SurfaceRole
Source§fn default() -> SurfaceRole
fn default() -> SurfaceRole
Source§impl Hash for SurfaceRole
impl Hash for SurfaceRole
Source§impl Ord for SurfaceRole
impl Ord for SurfaceRole
Source§fn cmp(&self, other: &SurfaceRole) -> Ordering
fn cmp(&self, other: &SurfaceRole) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SurfaceRole
impl PartialEq for SurfaceRole
Source§fn eq(&self, other: &SurfaceRole) -> bool
fn eq(&self, other: &SurfaceRole) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for SurfaceRole
impl PartialOrd for SurfaceRole
impl Copy for SurfaceRole
impl Eq for SurfaceRole
impl StructuralPartialEq for SurfaceRole
Auto Trait Implementations§
impl Freeze for SurfaceRole
impl RefUnwindSafe for SurfaceRole
impl Send for SurfaceRole
impl Sync for SurfaceRole
impl Unpin for SurfaceRole
impl UnsafeUnpin for SurfaceRole
impl UnwindSafe for SurfaceRole
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.