Skip to main content

Theme

Struct Theme 

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

CLI theme with selectable color palettes and optional typewriter effects.

Precedence: --color flag > NO_COLOR env var > TTY auto-detection. Draw (typewriter) is enabled by default on interactive TTY, disabled with --no-draw.

Implementations§

Source§

impl Theme

Source

pub fn detect() -> Self

Source

pub fn from_flags(color_flag: &str, theme_flag: &str) -> Self

Source

pub fn resolve(mode: ColorMode, variant: ThemeVariant) -> Self

Source

pub fn plain() -> Self

Source

pub fn with_draw(self, draw: bool) -> Self

Source

pub fn with_nerdmode(self, nerd: bool) -> Self

Source

pub fn colors_enabled(&self) -> bool

Source

pub fn draw_enabled(&self) -> bool

Source

pub fn variant(&self) -> ThemeVariant

Source

pub fn nerdmode(&self) -> bool

Source

pub fn icon_ok(&self) -> &'static str

Source

pub fn icon_action(&self) -> &'static str

Source

pub fn icon_warn(&self) -> &'static str

Source

pub fn icon_detail(&self) -> &'static str

Source

pub fn icon_error(&self) -> &'static str

Source

pub fn accent(&self) -> &'static str

Emphasis/highlight color. Bright green, bright orange, or bold depending on variant.

Source

pub fn dim(&self) -> &'static str

Body-text color. Matches the variant’s base tone; empty for Terminal.

Source

pub fn mono(&self) -> &'static str

Monospace-value color. Same as accent for CRT variants; bold for Terminal.

Source

pub fn success(&self) -> &'static str

Bright green. Explicit “all passed” summaries, enabled/active states.

Source

pub fn warn(&self) -> &'static str

Bright yellow. Warnings, fallback states, skipped items.

Source

pub fn error(&self) -> &'static str

Bright red. Errors, failures, disabled states.

Source

pub fn info(&self) -> &'static str

Bright cyan. Auto-fix actions, debug info, discovery output.

Source

pub fn bold(&self) -> &'static str

Source

pub fn reset(&self) -> &'static str

Soft reset: clears styles and re-tints to the variant’s body color. For Terminal variant, this is a plain reset (no tint).

Source

pub fn hard_reset(&self) -> &'static str

Hard reset: returns terminal to default colors. Use at program exit.

Source

pub fn typewrite(&self, text: &str, delay_ms: u64)

Typewrite to stderr, character-by-character. ANSI sequences emitted instantly. Skips delay when draw is disabled (instant print).

Source

pub fn typewrite_line(&self, text: &str, delay_ms: u64)

Typewrite to stderr + newline.

Source

pub fn typewrite_stdout(&self, text: &str, delay_ms: u64)

Typewrite to stdout, character-by-character.

Source

pub fn typewrite_line_stdout(&self, text: &str, delay_ms: u64)

Typewrite to stdout + newline.

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

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 Theme

Source§

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

Formats the value using the given formatter. 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 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more