Skip to main content

StyleSet

Struct StyleSet 

Source
pub struct StyleSet {
Show 17 fields pub name: String, pub author: String, pub is_dark: bool, pub primary: Style, pub secondary: Style, pub muted: Style, pub border: Style, pub border_muted: Style, pub selection: Style, pub cursor: Style, pub cursor_muted: Style, pub error: Style, pub warning: Style, pub info: Style, pub success: Style, pub highlight: Style, pub link: Style, /* private fields */
}
Expand description

The main StyleSet struct with predefined styles as named fields

Fields§

§name: String

Human-readable theme name.

§author: String

Theme author name or contact. Empty string if not specified.

§is_dark: bool

true for dark themes, false for light themes.

§primary: Style

The primary style for normal text and other elements.

§secondary: Style

A secondary style, for sidebars or other secondary elements.

§muted: Style

A muted style for disabled/deselected elements.

§border: Style

A style for borders and other decorative elements.

§border_muted: Style

A style for disabled borders and other decorative elements.

§selection: Style

A style for selected text or elements.

§cursor: Style

A cursor style

§cursor_muted: Style

A disabled cursor style

§error: Style

A style for errors

§warning: Style

A style for warnings

§info: Style

A style for informative text or elements such as spinners

§success: Style

It works!

§highlight: Style

A style for highlighted information or elements

§link: Style

URLs or other links

Implementations§

Source§

impl StyleSet

Source

pub fn from_name(name: &str) -> Self

Create a StyleSet from a theme name, with reasonable fallbacks.

Accepts any common case format: "Nord Dark", "nord-dark", "NordDark".

Source

pub fn from_default_light_cfg() -> Self

Create a light StyleSet from the user’s configured light default.

Fallback order:

  1. User configured light theme.
  2. Built-in default light theme.
Source

pub fn insert_custom(&mut self, key: impl Into<String>, style: Style)

Add a custom style by name

Source

pub fn get_custom(&self, key: &str) -> Option<&Style>

Get a custom style by name

Trait Implementations§

Source§

impl Clone for StyleSet

Source§

fn clone(&self) -> StyleSet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StyleSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StyleSet

Available on crate feature fs only.

Returns the user’s configured default theme as a StyleSet, falling back to the built-in default.

Reads $XDG_CONFIG_HOME/tca/tca.toml if the fs feature is enabled. For a guaranteed no-I/O default, convert directly from a BuiltinTheme.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&TcaTheme> for StyleSet

Source§

fn from(value: &TcaTheme) -> Self

Converts to this type from the input type.
Source§

impl From<TcaTheme> for StyleSet

Source§

fn from(value: TcaTheme) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.