pub struct CassTheme {
pub preset: ThemePreset,
pub is_dark: bool,
pub theme: Theme,
pub styles: StyleSheet,
pub profile: ColorProfile,
pub color_cache: ColorCache,
pub flags: ThemeFlags,
}Expand description
Central theme object consumed by every ftui widget in cass.
Wraps an ftui Theme, a StyleSheet with named styles, the detected
ColorProfile, and runtime ThemeFlags. All rendering code should
query styles through this struct rather than hard-coding colors.
Fields§
§preset: ThemePresetCurrent preset (for cycling).
is_dark: boolWhether dark mode is active.
theme: Themeftui Theme with semantic color slots.
styles: StyleSheetNamed style registry - the single source of truth for widget styles.
profile: ColorProfileDetected terminal color capability.
color_cache: ColorCacheColor downgrade cache (speeds up repeated color conversions).
flags: ThemeFlagsRuntime feature flags from environment.
Implementations§
Source§impl CassTheme
impl CassTheme
Sourcepub fn from_preset(preset: ThemePreset) -> Self
pub fn from_preset(preset: ThemePreset) -> Self
Build a theme from a preset, detecting color profile and env flags.
Sourcepub fn with_options(
preset: ThemePreset,
profile: ColorProfile,
flags: ThemeFlags,
) -> Self
pub fn with_options( preset: ThemePreset, profile: ColorProfile, flags: ThemeFlags, ) -> Self
Build a theme with explicit profile and flags (for testing / headless).
Sourcepub fn next_preset(&mut self)
pub fn next_preset(&mut self)
Cycle to the next preset and rebuild.
Sourcepub fn prev_preset(&mut self)
pub fn prev_preset(&mut self)
Cycle to the previous preset and rebuild.
Sourcepub fn style(&self, name: &str) -> Style
pub fn style(&self, name: &str) -> Style
Get an ftui Style by name from the stylesheet, falling back to
Style::default() if not found.
Sourcepub fn compose(&self, names: &[&str]) -> Style
pub fn compose(&self, names: &[&str]) -> Style
Compose multiple named styles left-to-right (later overrides earlier).
Sourcepub fn downgrade(&mut self, color: Color) -> Color
pub fn downgrade(&mut self, color: Color) -> Color
Downgrade an RGB color to the terminal’s color profile.
Sourcepub fn legacy_palette(&self) -> ThemePalette
pub fn legacy_palette(&self) -> ThemePalette
Get the legacy ThemePalette for code that hasn’t migrated yet.
Sourcepub fn show_icons(&self) -> bool
pub fn show_icons(&self) -> bool
Whether emoji icons should be shown.
Sourcepub fn show_gradient(&self) -> bool
pub fn show_gradient(&self) -> bool
Whether gradient simulation should be used.
Sourcepub fn show_animations(&self) -> bool
pub fn show_animations(&self) -> bool
Whether animations should play.
Sourcepub fn a11y_mode(&self) -> bool
pub fn a11y_mode(&self) -> bool
Whether accessibility mode is active (textual cues supplement color).
Sourcepub fn agent_icon(&self, agent: &str) -> &'static str
pub fn agent_icon(&self, agent: &str) -> &'static str
Get the agent icon glyph, respecting no_icons flag.
Sourcepub fn role_style(&self, role: &str) -> Style
pub fn role_style(&self, role: &str) -> Style
Get a role-specific ftui Style for message rendering.
Sourcepub fn role_bg_style(&self, role: &str) -> Style
pub fn role_bg_style(&self, role: &str) -> Style
Get role background style.
Sourcepub fn agent_pane_style(&self, agent: &str) -> (Style, Style)
pub fn agent_pane_style(&self, agent: &str) -> (Style, Style)
Get a pane style for a specific agent. Returns (bg_only, bg+fg) styles.
Sourcepub fn stripe_style(&self, row_idx: usize) -> Style
pub fn stripe_style(&self, row_idx: usize) -> Style
Get a zebra-stripe background style for a given row index.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CassTheme
impl RefUnwindSafe for CassTheme
impl Send for CassTheme
impl Sync for CassTheme
impl Unpin for CassTheme
impl UnsafeUnpin for CassTheme
impl UnwindSafe for CassTheme
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> 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> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().