Skip to main content

Theme

Struct Theme 

Source
pub struct Theme {
Show 15 fields pub border_focused: Style, pub border_unfocused: Style, pub border_popup: Style, pub border_error: Style, pub border_warning: Style, pub tab_active: Style, pub tab_inactive: Style, pub selection: Style, pub shortcut_key: Style, pub shortcut_indicator: Style, pub section_header: Style, pub body: Style, pub hint: Style, pub separator: Style, pub success: Style,
}
Expand description

Color and style palette for tui-kit components.

§Usage

Use Theme::native() (the default) for a palette that adapts to the user’s terminal color scheme, or Theme::dark() for a fixed lazygit-inspired dark palette.

§Extending for your app

Wrap Theme in your own struct for app-specific semantic roles:

pub struct AppTheme {
    pub base: Theme,            // passed to all tui-kit calls
    pub my_semantic: Style,     // app-specific roles
}

impl AppTheme {
    pub fn native() -> Self {
        Self {
            base: Theme::native(),
            my_semantic: Style::default().fg(Color::LightGreen),
        }
    }
}

Theme is Copy so it is cheap to pass by value or reference.

Fields§

§border_focused: Style

Border of the currently-focused interactive panel.

§border_unfocused: Style

Border of passive / display-only panels.

§border_popup: Style

Border of floating popups (always treated as focused).

§border_error: Style

Border of error popups.

§border_warning: Style

Border of warning popups.

§tab_active: Style

Label of the active tab.

§tab_inactive: Style

Label of an inactive tab.

§selection: Style

Style applied to the selected row in a list (fg + bg combined).

§shortcut_key: Style

Inline keyboard shortcut labels (e.g. “Enter”, “Tab”).

§shortcut_indicator: Style

The -[n]- digit indicator shown in widget titles.

§section_header: Style

Section / group headers inside popups.

§body: Style

Normal body text.

§hint: Style

Dimmed hint and footer text.

§separator: Style

Separator lines (─ characters).

§success: Style

Positive / success signal (e.g. toast success, CI pass).

Implementations§

Source§

impl Theme

Source

pub fn native() -> Self

16-color native palette — adapts to the user’s terminal color scheme.

Uses only the 16 named ANSI colors so the result respects the terminal theme (dark/light, Solarized, Nord, etc.).

RoleColor
Accent / focusedLightBlue
Tabs / headersLightBlue
ShortcutsYellow
SelectionBlack on LightBlue
Positive signalLightGreen
Negative signalLightRed
Muted / hintsDarkGray
Source

pub fn dark() -> Self

Fixed dark palette with green accents — does not adapt to terminal theme.

Use when you know the terminal has a dark background and want a consistent lazygit-inspired look regardless of terminal settings.

RoleColor
Accent / focusedGreen + Bold
Unfocused borderWhite
Active tabGreen + Bold
SelectionWhite on Blue + Bold
Shortcut keysYellow
Section headersCyan + Bold
HintsDarkGray

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

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

impl Default for Theme

Source§

fn default() -> Self

Returns the “default value” for a type. 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, 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.