Expand description
Terminal styling system with theme support and color detection for thag_rs and third party applications.
This crate provides a comprehensive styling system for terminal applications, including:
- Color detection and terminal capability assessment
- Theme-based styling with semantic roles
inquireUI integration for consistent theming- ANSI color conversion and optimization
- Built-in theme collection
Re-exports§
pub use styling::display_terminal_attributes;pub use styling::display_theme_details;pub use styling::display_theme_roles;pub use styling::find_closest_color;pub use styling::get_rgb;pub use styling::index_to_rgb;pub use styling::paint_for_role;pub use styling::AnsiStyleExt;pub use styling::Color;pub use styling::ColorInfo;pub use styling::ColorInitStrategy;pub use styling::ColorValue;pub use styling::HowInitialized;pub use styling::Palette;pub use styling::PaletteConfig;pub use styling::Role;pub use styling::Style;pub use styling::Styleable;pub use styling::Styled;pub use styling::StyledPrint;pub use styling::StyledString;pub use styling::Styler;pub use styling::TermAttributes;pub use styling::Theme;pub use integrations::ThemedStyle;pub use palette_sync::PaletteSync;pub use exporters::export_all_formats;pub use exporters::export_theme_to_file;pub use exporters::generate_installation_instructions;pub use exporters::ExportFormat;pub use exporters::ThemeExporter;
Modules§
- exporters
- Format-specific theme export implementations.
- help_
system - Lightweight help system for thag tools
- integrations
- Integration modules for third-party terminal styling crates
- palette_
sync - Runtime terminal palette synchronization using OSC escape sequences
- styling
- Message styling
- terminal
- This module handles detection of terminal capabilities while preserving terminal state. In particular, it manages raw mode status which can be affected by some detection operations.
Macros§
- auto_
help - Macro to automatically extract help from current source file
- cprtln
Deprecated - Print line with embedded styled content
- cvprtln
Deprecated - Conditionally logs a message with verbosity control and styling.
- debug_
log - Debugging logger.
- file_
navigator - Generates a
FileNavigatorto allow the user to navigate the file system and select files and directories from a command-line interface. - help_
system - Macro to create a help system - manually specify the source
- prtln
- Ungated print line macro for user messages
- re
- Lazy-static regular expression generator.
- set_
verbosity - Convenient macro for setting global verbosity with short syntax.
- sprtln
- Styled print line macro (replacement for
cprtln!) Format:sprtln!(style: Style, "Lorem ipsum dolor {} amet", content: &str);Also accepts Role:sprtln!(Role::Code, "Hello {}", "world"); - styled
- Applies styling to text using inline color and style codes.
- svprtln
- Styled verbosity-gated print line macro (replacement for
cvprtln!) Conditionally logs a message with verbosity control and styling. - vprtln
- Verbosity-gated print line macro for user messages
Structs§
- NoConfig
Provider - Default implementation that uses no configuration
Enums§
- Color
Support - An enum to categorise the current terminal’s level of colour support as detected, configured or defaulted.
- Styling
Error - Error types for styling operations
- Term
BgLuma - Terminal background luminance detection and specification
- Theme
Error - Theme-related error types
- Verbosity
- Controls the detail level of user messaging
Statics§
- OUTPUT_
MANAGER - Global output manager instance protected by a reentrant mutex for thread-safe access
Traits§
- Styling
Config Provider - Trait for providing styling configuration to break circular dependency
Functions§
- display_
color_ comparison - Display side-by-side color comparison of terminal palette vs
thag_stylingtheme. - get_
verbosity - Initializes and returns the global verbosity setting.
- hsl_
to_ rgb - Helper: HSL -> RGB
- init_
verbosity - Initialize verbosity with a convenient function that handles common patterns.
- is_
konsole - Check if running in konsole (always supports
TrueColor) - is_
light_ color - Check if a color is considered light
- is_
mintty - Check if running in mintty (always supports
TrueColor) - rgb_
to_ hsl - Helper: RGB -> HSL
- set_
global_ verbosity - Set the output verbosity for the current execution.
- set_
verbosity_ from_ env - Set global verbosity from the
THAG_VERBOSITYenvironment variable.
Type Aliases§
- Styling
Result - Result type alias for styling operations
- Thag
Common Result - Result type alias for
thag_commonoperations - V
- Type alias for Verbosity to provide a shorter name for convenience