pub struct Theme {Show 32 fields
pub user_message: Style,
pub assistant_message: Style,
pub system_message: Style,
pub input_text: Style,
pub input_cursor: Style,
pub status_bar: Style,
pub header: Style,
pub panel_border: Style,
pub panel_title: Style,
pub highlight: Style,
pub error: Style,
pub thinking_message: Style,
pub code_inline: Style,
pub code_block: Style,
pub streaming_cursor: Style,
pub tool_command: Style,
pub assistant_accent: Style,
pub tool_accent: Style,
pub diff_added_bg: Color,
pub diff_removed_bg: Color,
pub diff_word_added_bg: Color,
pub diff_word_removed_bg: Color,
pub diff_gutter_add: Style,
pub diff_gutter_remove: Style,
pub diff_header: Style,
pub link: Style,
pub table_border: Style,
pub user_message_bg: Color,
pub turn_separator: Style,
pub tool_success: Style,
pub tool_failure: Style,
pub syntax_theme: SyntaxTheme,
}Expand description
Visual theme for the TUI dashboard widgets.
Contains Style values for every distinct UI element — message roles,
input fields, borders, diff gutters, hyperlinks, and status elements.
The Default implementation provides a dark blue colour scheme.
Build a configured theme with Theme::from_palette_with_mode at startup and store it
in the TUI App; widget render functions receive &Theme as a parameter.
§Examples
use zeph_tui::theme::{Theme, SemanticPalette, resolve_color_mode};
use zeph_config::ColorMode;
let palette = SemanticPalette::zephyr();
// Use Truecolor so the test is deterministic regardless of the CI environment.
let mode = resolve_color_mode(ColorMode::Truecolor);
let theme = Theme::from_palette_with_mode(&palette, mode);
assert_ne!(theme.user_message, theme.assistant_message);Fields§
§user_message: StyleStyle applied to user-role chat messages.
assistant_message: StyleStyle applied to assistant-role chat messages.
system_message: StyleStyle applied to system-role chat messages.
input_text: StyleStyle for the text body of the input field.
input_cursor: StyleStyle for the blinking cursor in the input field.
status_bar: StyleStyle for the status bar at the bottom of the screen.
header: StyleStyle for the top header bar (provider / model info).
panel_border: StyleStyle for panel border lines.
panel_title: StyleStyle for panel title labels.
highlight: StyleStyle for highlighted / selected items.
error: StyleStyle for error messages and indicators.
thinking_message: StyleStyle for thinking / reasoning messages.
code_inline: StyleStyle for inline code spans within chat messages.
code_block: StyleStyle for multi-line code blocks.
streaming_cursor: StyleStyle for the streaming cursor shown while the model is generating.
tool_command: StyleStyle for tool command lines (shell commands, etc.).
assistant_accent: StyleAccent style for assistant messages (orange / warm tone).
tool_accent: StyleAccent style for tool output messages (olive / warm tone).
diff_added_bg: ColorBackground colour for added lines in diffs.
diff_removed_bg: ColorBackground colour for removed lines in diffs.
diff_word_added_bg: ColorBackground colour for word-level added regions in diffs.
diff_word_removed_bg: ColorBackground colour for word-level removed regions in diffs.
diff_gutter_add: StyleStyle for the + gutter marker in diffs.
diff_gutter_remove: StyleStyle for the - gutter marker in diffs.
diff_header: StyleStyle for diff file/hunk headers.
link: StyleStyle for hyperlinks.
table_border: StyleStyle for table border lines.
user_message_bg: ColorBackground tint applied to user message lines.
turn_separator: StyleStyle for turn-separator lines between role changes.
tool_success: StyleStyle for the bullet of a successfully completed tool call.
tool_failure: StyleStyle for the bullet of a failed tool call.
syntax_theme: SyntaxThemeSyntax-highlight styles for code blocks and diffs.
Initialised once at startup; passed as &theme.syntax_theme to render_diff_lines
and the syntax highlighter so that SyntaxTheme::default() is never called per frame.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn from_palette(p: &SemanticPalette) -> Self
pub fn from_palette(p: &SemanticPalette) -> Self
Derive all widget styles from a SemanticPalette at truecolor fidelity.
Equivalent to from_palette_with_mode(p, EffectiveColorMode::Truecolor).
§Examples
use zeph_tui::theme::{Theme, SemanticPalette};
let theme = Theme::from_palette(&SemanticPalette::zephyr());
assert_ne!(theme.user_message, theme.assistant_message);Sourcepub fn from_palette_with_mode(p: &Palette, mode: Ecm) -> Self
pub fn from_palette_with_mode(p: &Palette, mode: Ecm) -> Self
Derive all widget styles from a SemanticPalette, downgrading colours for the
given terminal capability.
This is the single derivation path — all Rgb values produced here pass through
apply_mode (for Style fields) and map_color (for bare Color fields).
The downgrade happens exactly once at startup, never per frame.
§Examples
use zeph_tui::theme::{Theme, SemanticPalette, EffectiveColorMode};
let t = Theme::from_palette_with_mode(&SemanticPalette::zephyr(), EffectiveColorMode::Ansi256);
// In Ansi256 mode, colours are indexed — no Rgb variants in fg/bg.
if let Some(fg) = t.user_message.fg {
assert!(!matches!(fg, ratatui::style::Color::Rgb(..)));
}Trait Implementations§
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> 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request