#[repr(u8)]pub enum SystemColor {
Show 16 variants
Accent = 0,
Text = 1,
SecondaryText = 2,
Background = 3,
Surface = 4,
TertiaryText = 5,
Placeholder = 6,
Link = 7,
Separator = 8,
ControlFill = 9,
GroupedBackground = 10,
ElevatedSurface = 11,
Selection = 12,
Destructive = 13,
Success = 14,
Warning = 15,
}Expand description
A platform color role: what a color means, which each toolkit answers with its own
palette (docs/color.md “System colors”). Pass a role wherever a color is taken
(.background(SystemColor::Surface), label(..).color(SystemColor::Link)) and the view
follows the appearance, the accent and the contrast setting.
Every role maps to a real platform color on every toolkit, or to the documented
light/dark pair in SystemColor::fallback where a platform has none.
Variants§
Accent = 0
The app’s accent: selection, the prominent button, a focus ring.
Text = 1
Primary text.
SecondaryText = 2
De-emphasized text: a caption, a detail line.
Background = 3
The window’s content background.
Surface = 4
A region set off from the background: a panel, a card, a sidebar.
TertiaryText = 5
Text a step quieter than secondary: a disabled-looking hint, a footnote.
Placeholder = 6
A text field’s placeholder.
Link = 7
A link in running text.
Separator = 8
A hairline between items: a rule, a list separator, a grid line.
ControlFill = 9
The fill of a control’s track or well: a slider’s track, a segmented control’s background, a search field.
GroupedBackground = 10
The background behind grouped sections (an inset grouped list, a settings page).
ElevatedSurface = 11
A surface raised above the content: a popover, a menu, a sheet in dark appearance.
Selection = 12
The highlight behind selected text or selected content the app draws itself. Text keeps its own color on it.
Destructive = 13
A destructive action or an error.
Success = 14
Success, a value that rose.
Warning = 15
A warning, something to notice.
Implementations§
Source§impl SystemColor
impl SystemColor
Sourcepub const COUNT: usize = 16
pub const COUNT: usize = 16
How many roles there are: the length of SystemColor::ALL and of a Palette.
Sourcepub const ALL: [SystemColor; 16]
pub const ALL: [SystemColor; 16]
All roles, in discriminant order (the wire order: a role crosses JNI, C++ and JS as its position here).
Sourcepub const fn wire(self) -> u8
pub const fn wire(self) -> u8
The role as its wire number: its position in SystemColor::ALL.
Sourcepub const fn from_wire(n: u8) -> Option<SystemColor>
pub const fn from_wire(n: u8) -> Option<SystemColor>
The role with wire number n, if there is one.
Sourcepub const fn with_alpha(self, alpha: f64) -> Ink
pub const fn with_alpha(self, alpha: f64) -> Ink
This role at opacity alpha, replacing the role’s own alpha: a wash of the accent
behind a selected chip (SystemColor::Accent.with_alpha(0.14)).
Sourcepub const fn fallback(self, dark: bool) -> Color
pub const fn fallback(self, dark: bool) -> Color
Day’s own light/dark pair for the role: what a toolkit answers where its platform has
no such color, and what Palette::fallback holds. Fixed sRGB colors, close to the
Apple system palette, not an approximation of a user-chosen accent.
Trait Implementations§
Source§impl Clone for SystemColor
impl Clone for SystemColor
Source§fn clone(&self) -> SystemColor
fn clone(&self) -> SystemColor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SystemColor
Source§impl Debug for SystemColor
impl Debug for SystemColor
impl Eq for SystemColor
Source§impl From<SystemColor> for Ink
impl From<SystemColor> for Ink
Source§fn from(role: SystemColor) -> Ink
fn from(role: SystemColor) -> Ink
Source§impl From<SystemColor> for Paint
impl From<SystemColor> for Paint
Source§fn from(role: SystemColor) -> Paint
fn from(role: SystemColor) -> Paint
Source§impl Hash for SystemColor
impl Hash for SystemColor
Source§impl IntoReactive<Ink, IntoMark<SystemColor>> for SystemColor
impl IntoReactive<Ink, IntoMark<SystemColor>> for SystemColor
fn into_reactive(self) -> Reactive<Ink>
Source§impl IntoReactive<Paint, IntoMark<SystemColor>> for SystemColor
impl IntoReactive<Paint, IntoMark<SystemColor>> for SystemColor
fn into_reactive(self) -> Reactive<Paint>
Source§impl PartialEq for SystemColor
impl PartialEq for SystemColor
impl StructuralPartialEq for SystemColor
Auto Trait Implementations§
impl Forget for SystemColor
impl Freeze for SystemColor
impl Move for SystemColor
impl RefUnwindSafe for SystemColor
impl Send for SystemColor
impl Sync for SystemColor
impl Unpin for SystemColor
impl UnsafeUnpin for SystemColor
impl UnwindSafe for SystemColor
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> Equivalent<K> for Q
impl<Q, K> Equivalent<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.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more