Skip to main content

Theme

Struct Theme 

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

A resolved theme. Construct with Theme::new (One-Dark) or Theme::with_palette; every accessor returns a ratatui Style that is plain (Style::default) when color is disabled.

Implementations§

Source§

impl Theme

Source

pub fn new(enabled: bool) -> Theme

Builds a theme over the default (One-Dark) palette. When enabled is false every color accessor returns a plain style, preserving the monochrome (NO_COLOR) appearance.

Source

pub fn with_palette(enabled: bool, palette: Palette) -> Theme

Builds a theme over a specific Palette (the configured one). Color is still gated by enabled.

Source

pub fn enabled(&self) -> bool

Whether color is enabled (some widgets adjust their fallback styling).

Source

pub fn current(&self) -> Style

Style for the current-worktree marker (*/▸).

Source

pub fn missing(&self) -> Style

Style for the missing-worktree marker (!/✘).

Source

pub fn detached(&self) -> Style

Style for the detached-HEAD marker (~/⚓).

Source

pub fn branchless(&self) -> Style

Style for the worktree-less branch marker (): muted, since a branch row is secondary to the real worktrees above it (issue #47).

Source

pub fn dirty(&self) -> Style

Style for the dirty marker (M/●).

Source

pub fn untracked(&self) -> Style

Style for the untracked marker (?).

Source

pub fn absent(&self) -> Style

Style for the “field unavailable” placeholder ().

Source

pub fn spinner(&self) -> Style

Style for the per-field loading spinner ().

Source

pub fn ahead(&self, count: u32) -> Style

Style for the ahead count (↑N): green when ahead, muted at zero.

Source

pub fn behind(&self, count: u32) -> Style

Style for the behind count (↓N): red when behind, muted at zero.

Source

pub fn commit_hash(&self) -> Style

Style for a commit short hash.

Source

pub fn time(&self) -> Style

Style for a relative timestamp.

Source

pub fn branch(&self, is_current: bool, is_detached: bool) -> Style

Style for a branch name, by role.

Source

pub fn pr_state(&self, state: PrState) -> Style

Style for a PR’s number/state cell, by PR state.

Source

pub fn selection(&self) -> Style

The selected-row highlight: a background bar when color is enabled (so the per-field foreground colors stay readable), reversed video otherwise.

Source

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

The left-bar highlight symbol for the selected row.

Source

pub fn mode_chip(&self, mode: &Mode) -> Style

The status-bar mode chip, colored per mode (reversed when disabled).

Source

pub fn border(&self, focused: bool) -> Style

A pane border style; the focused pane is accented, others muted.

Source

pub fn title(&self, focused: bool) -> Style

A pane title style; the focused pane is accented/bold, others muted.

Source

pub fn hint_key(&self) -> Style

Style for a key token in the status-bar / help key hints.

Source

pub fn hint_label(&self) -> Style

Style for the description text next to a key hint.

Source

pub fn label(&self) -> Style

Style for a detail-pane field label.

Source

pub fn accent(&self) -> Style

The accent style (active fields, prompts).

Source

pub fn url(&self) -> Style

Style for a clickable/URL value.

Source

pub fn status(&self, kind: StatusKind) -> Style

Style for a transient status message, by severity.

Source

pub fn error(&self) -> Style

Style for error text in modals.

Source

pub fn warning(&self) -> Style

Style for warning text in modals.

Source

pub fn success(&self) -> Style

Style for a reassuring/positive note (e.g. “merged — safe to delete”).

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> 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> 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> Same for T

Source§

type Output = T

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