pub struct Theme {Show 14 fields
pub background: Color,
pub foreground: Color,
pub border: Color,
pub focused: Color,
pub selected: Color,
pub disabled: Color,
pub placeholder: Color,
pub primary: Color,
pub success: Color,
pub warning: Color,
pub error: Color,
pub info: Color,
pub progress_filled: Color,
pub progress_empty: Color,
}Expand description
A theme defines the color scheme for all Envision components.
Each color in the theme corresponds to a semantic UI state or element type. Components use these colors through the theme’s style helper methods.
§Fields
- Base colors:
background,foreground,border- general UI colors - Interactive states:
focused,selected,disabled,placeholder - Semantic colors:
primary,success,warning,error,info - Progress bar:
progress_filled,progress_empty
§Example
use envision::theme::Theme;
let theme = Theme::nord();
assert_eq!(theme.focused, envision::theme::NORD8);Fields§
§background: ColorBackground color for UI elements.
foreground: ColorForeground (text) color.
border: ColorBorder color for boxes and frames.
focused: ColorColor for focused elements (borders, text).
selected: ColorColor for selected items in lists/tables.
disabled: ColorColor for disabled elements.
placeholder: ColorColor for placeholder text.
primary: ColorPrimary accent color.
success: ColorSuccess state color (green).
warning: ColorWarning state color (yellow/orange).
error: ColorError state color (red).
info: ColorInformational state color (blue/cyan).
progress_filled: ColorFilled portion of progress bars.
progress_empty: ColorEmpty portion of progress bars.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn nord() -> Self
pub fn nord() -> Self
Creates a new Nord-themed color scheme.
The Nord theme uses the popular Nord color palette with its characteristic frost blues and aurora accent colors.
§Colors
- Focused: Nord8 (light blue #88C0D0)
- Selected: Nord9 (blue #81A1C1)
- Disabled: Nord3 (muted gray #4C566A)
- Success: Nord14 (green #A3BE8C)
- Warning: Nord13 (yellow #EBCB8B)
- Error: Nord11 (red #BF616A)
§Example
use envision::theme::Theme;
let theme = Theme::nord();
// Use with components:
// Button::view(&state, frame, area, &theme);Sourcepub fn focused_style(&self) -> Style
pub fn focused_style(&self) -> Style
Returns a style for focused elements.
Uses the theme’s focused color for foreground.
Sourcepub fn focused_bold_style(&self) -> Style
pub fn focused_bold_style(&self) -> Style
Returns a style for focused elements with bold modifier.
Sourcepub fn focused_border_style(&self) -> Style
pub fn focused_border_style(&self) -> Style
Returns a style for focused borders.
Sourcepub fn selected_style(&self, focused: bool) -> Style
pub fn selected_style(&self, focused: bool) -> Style
Returns a style for selected items.
Uses bold modifier. In focused context, also uses focused color.
Sourcepub fn selected_highlight_style(&self, focused: bool) -> Style
pub fn selected_highlight_style(&self, focused: bool) -> Style
Returns a style for selected items with background highlight.
Sourcepub fn disabled_style(&self) -> Style
pub fn disabled_style(&self) -> Style
Returns a style for disabled elements.
Sourcepub fn placeholder_style(&self) -> Style
pub fn placeholder_style(&self) -> Style
Returns a style for placeholder text.
Sourcepub fn normal_style(&self) -> Style
pub fn normal_style(&self) -> Style
Returns a style for default/normal elements.
Sourcepub fn border_style(&self) -> Style
pub fn border_style(&self) -> Style
Returns a style for borders (non-focused).
Sourcepub fn success_style(&self) -> Style
pub fn success_style(&self) -> Style
Returns a style for success messages/indicators.
Sourcepub fn warning_style(&self) -> Style
pub fn warning_style(&self) -> Style
Returns a style for warning messages/indicators.
Sourcepub fn error_style(&self) -> Style
pub fn error_style(&self) -> Style
Returns a style for error messages/indicators.
Sourcepub fn info_style(&self) -> Style
pub fn info_style(&self) -> Style
Returns a style for informational messages/indicators.
Sourcepub fn progress_filled_style(&self) -> Style
pub fn progress_filled_style(&self) -> Style
Returns a style for the filled portion of progress bars.
Trait Implementations§
impl Eq for Theme
impl StructuralPartialEq for Theme
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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