pub struct Theme {
pub name: String,
pub primary: Color,
pub secondary: Color,
pub accent: Color,
pub background: Color,
pub foreground: Color,
pub error: Color,
pub warning: Color,
pub success: Color,
}Expand description
Theme definition
Fields§
§name: StringTheme name
primary: ColorPrimary color
secondary: ColorSecondary color
accent: ColorAccent color
background: ColorBackground color
foreground: ColorForeground color
error: ColorError color
warning: ColorWarning color
success: ColorSuccess color
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn high_contrast() -> Self
pub fn high_contrast() -> Self
Create a high contrast theme for accessibility
Sourcepub fn detect_color_support() -> ColorSupport
pub fn detect_color_support() -> ColorSupport
Detect terminal color capabilities
Sourcepub fn available_themes() -> Vec<&'static str>
pub fn available_themes() -> Vec<&'static str>
Get all available theme names
Sourcepub fn meets_wcag_aa(&self) -> bool
pub fn meets_wcag_aa(&self) -> bool
Check if the theme meets WCAG AA contrast standards
Sourcepub fn meets_wcag_aaa(&self) -> bool
pub fn meets_wcag_aaa(&self) -> bool
Check if the theme meets WCAG AAA contrast standards
Sourcepub fn foreground_contrast(&self) -> f32
pub fn foreground_contrast(&self) -> f32
Get contrast ratio between foreground and background
Sourcepub fn primary_contrast(&self) -> f32
pub fn primary_contrast(&self) -> f32
Get contrast ratio between primary color and background
Sourcepub fn error_contrast(&self) -> f32
pub fn error_contrast(&self) -> f32
Get contrast ratio between error color and background
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Theme
impl<'de> Deserialize<'de> for Theme
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnwindSafe for Theme
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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