Skip to main content

Crate ftui_style

Crate ftui_style 

Source
Expand description

Style types for FrankenTUI with CSS-like cascading semantics.

§Role in FrankenTUI

ftui-style is the shared vocabulary for colors and styling. Widgets, render, and extras use these types to stay visually consistent without dragging in rendering or runtime dependencies.

§This crate provides

  • Style for unified text styling with CSS-like inheritance.
  • StyleSheet for named style registration (CSS-like classes).
  • Theme for semantic color slots with light/dark mode support.
  • Color types and downgrade utilities.
  • Table themes and effects used by widgets and markdown rendering.

§How it fits in the system

ftui-render stores style values in cells, ftui-widgets computes styles for UI components, and ftui-extras uses themes for richer rendering (markdown, charts, and demo visuals). This crate keeps that style layer deterministic and reusable.

Re-exports§

pub use color::Ansi16;
pub use color::Color;
pub use color::ColorCache;
pub use color::ColorProfile;
pub use color::MonoColor;
pub use color::Rgb;
pub use color::WCAG_AA_LARGE_TEXT;
pub use color::WCAG_AA_NORMAL_TEXT;
pub use color::WCAG_AAA_LARGE_TEXT;
pub use color::WCAG_AAA_NORMAL_TEXT;
pub use color::best_text_color;
pub use color::best_text_color_packed;
pub use color::contrast_ratio;
pub use color::contrast_ratio_packed;
pub use color::meets_wcag_aa;
pub use color::meets_wcag_aa_large_text;
pub use color::meets_wcag_aa_packed;
pub use color::meets_wcag_aaa;
pub use color::relative_luminance;
pub use color::relative_luminance_packed;
pub use interactive::InteractionState;
pub use interactive::InteractiveStyle;
pub use style::LineClamp;
pub use style::Overflow;
pub use style::Style;
pub use style::StyleFlags;
pub use style::TextAlign;
pub use style::TextOverflow;
pub use style::TextTransform;
pub use style::WhiteSpaceMode;
pub use stylesheet::StyleId;
pub use stylesheet::StyleSheet;
pub use table_theme::BlendMode;
pub use table_theme::Gradient;
pub use table_theme::StyleMask;
pub use table_theme::TableEffect;
pub use table_theme::TableEffectResolver;
pub use table_theme::TableEffectRule;
pub use table_theme::TableEffectScope;
pub use table_theme::TableEffectTarget;
pub use table_theme::TablePresetId;
pub use table_theme::TableSection;
pub use table_theme::TableTheme;
pub use table_theme::TableThemeDiagnostics;
pub use table_theme::TableThemeSpec;
pub use theme::AdaptiveColor;
pub use theme::ResolvedTheme;
pub use theme::Theme;
pub use theme::ThemeBuilder;

Modules§

color
Color types, profiles, and downgrade utilities. Color types, profiles, and downgrade utilities.
interactive
Interactive style variants for stateful widgets. Interactive style variants for stateful widgets.
style
Style types with CSS-like cascading semantics. Style types for terminal UI styling with CSS-like cascading semantics.
stylesheet
StyleSheet registry for named styles. StyleSheet registry for named styles.
table_theme
Table theme types and presets. TableTheme core types and preset definitions.
theme
Theme system with semantic color slots. Theme system with semantic color slots.