Skip to main content

Theme

Struct Theme 

Source
pub struct Theme { /* private fields */ }
Expand description

A collection of styles for each semantic role.

Themes map each StyleRole to a concrete Style.

Implementations§

Source§

impl Theme

Source

pub const NAMES: &'static [&'static str]

Canonical list of all built-in theme names.

Source

pub fn by_name(name: &str) -> Option<Theme>

Look up a built-in theme by name (case-insensitive, kebab-case or snake_case).

Source

pub const fn empty() -> Theme

Create a theme with empty (plain) styles for every role.

Source

pub fn dark() -> Theme

The default dark theme.

Calibrated for modern dark terminal backgrounds with restrained, warm developer syntax highlighting.

Source

pub fn light() -> Theme

A light theme optimized for light / white background terminals.

Source

pub fn monochrome() -> Theme

A monochrome theme using clear terminal effects (bold, dim, italic, underline) without colors.

Source

pub fn ansi16() -> Theme

A theme using only standard 16 ANSI colors for maximum compatibility.

Source

pub fn gruvbox() -> Theme

The Gruvbox theme (warm, earthy palette).

Source

pub fn nord() -> Theme

The Nord theme (arctic, cool bluish-slate palette).

Source

pub fn dracula() -> Theme

The Dracula theme (classic high-contrast dark theme).

Source

pub fn solarized_dark() -> Theme

The Solarized Dark theme.

Source

pub fn solarized_light() -> Theme

The Solarized Light theme.

Source

pub fn one_dark() -> Theme

The One Dark theme (iconic Atom/VS Code palette).

Source

pub fn catppuccin_mocha() -> Theme

The Catppuccin Mocha theme (popular soft pastel comfort palette).

Source

pub fn catppuccin() -> Theme

Source

pub fn tokyo_night() -> Theme

The Tokyo Night theme (neon city night aesthetic).

Source

pub fn monokai() -> Theme

The Monokai theme (the classic Sublime Text / TextMate palette).

Source

pub fn ayu_dark() -> Theme

The Ayu Dark theme.

Source

pub const fn with(self, role: StyleRole, style: Style) -> Theme

Set the style for a specific semantic role.

Source

pub const fn style(&self, role: StyleRole) -> Style

Get the style for a specific semantic role.

Source

pub fn adapt_to(self, level: ColorLevel) -> Theme

Adapt theme colors to match the target color capability level.

Source

pub fn to_ansi256(self) -> Theme

Convert all colors in the theme to 256-color palette.

Source

pub fn to_ansi16(self) -> Theme

Convert all colors in the theme to standard 16 ANSI colors.

Source

pub fn to_monochrome(self) -> Theme

Convert the theme to monochrome (preserve effects like bold/dim, strip colors).

Source

pub fn is_plain(&self) -> bool

True if all styles in the theme are plain/empty.

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Theme

Source§

impl Debug for Theme

Source§

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

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

impl Default for Theme

Source§

fn default() -> Theme

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

impl Eq for Theme

Source§

impl PartialEq for Theme

Source§

fn eq(&self, other: &Theme) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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 UnsafeUnpin for Theme

§

impl UnwindSafe for Theme

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.