pub struct ThemePreset(/* private fields */);Expand description
One named built-in terminal theme.
The catalog is generated from the terminal palette files in the pinned
iTerm2-Color-Schemes snapshot documented in
urushi/THIRD_PARTY_NOTICES.md. Every source theme is present; Urushi does
not select a preferred subset.
A terminal palette describes indexed colors, while an Urushi theme
describes semantic UI roles. The conversion uses terminal
foreground/background for text/background, ANSI red/green/yellow/blue
for the corresponding semantic colors, neutral foreground/background
blends for surface, text_muted, and border, and the background for
accent_text.
use urushi::{ColorScheme, ThemePreset, ThemeSet};
let light = ThemePreset::get("Catppuccin Latte").unwrap();
let dark = ThemePreset::get("Catppuccin Mocha").unwrap();
assert_eq!(light.scheme(), ColorScheme::Light);
assert_eq!(dark.scheme(), ColorScheme::Dark);
let themes = ThemeSet::new(light.theme(), dark.theme());
assert_ne!(themes.light().tokens().background, themes.dark().tokens().background);Implementations§
Source§impl ThemePreset
impl ThemePreset
Sourcepub const fn scheme(self) -> ColorScheme
pub const fn scheme(self) -> ColorScheme
Returns whether this preset has a light or dark background.
Trait Implementations§
Source§impl Clone for ThemePreset
impl Clone for ThemePreset
Source§fn clone(&self) -> ThemePreset
fn clone(&self) -> ThemePreset
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThemePreset
impl Debug for ThemePreset
Source§impl Display for ThemePreset
impl Display for ThemePreset
Source§impl Hash for ThemePreset
impl Hash for ThemePreset
Source§impl PartialEq for ThemePreset
impl PartialEq for ThemePreset
Source§fn eq(&self, other: &ThemePreset) -> bool
fn eq(&self, other: &ThemePreset) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ThemePreset
impl Eq for ThemePreset
impl StructuralPartialEq for ThemePreset
Auto Trait Implementations§
impl Freeze for ThemePreset
impl RefUnwindSafe for ThemePreset
impl Send for ThemePreset
impl Sync for ThemePreset
impl Unpin for ThemePreset
impl UnsafeUnpin for ThemePreset
impl UnwindSafe for ThemePreset
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