tl_cli/ui/
theme.rs

1//! Consistent styling utilities for CLI output.
2//!
3//! Provides color and formatting helpers using owo-colors.
4
5use owo_colors::OwoColorize;
6use std::fmt::Display;
7
8/// Styles for different semantic elements.
9pub struct Style;
10
11impl Style {
12    /// Style for section headers (e.g., "Configuration", "Available commands")
13    pub fn header<T: Display>(text: T) -> String {
14        format!("{}", text.bold())
15    }
16
17    /// Style for labels/keys (e.g., "provider", "model")
18    pub fn label<T: Display>(text: T) -> String {
19        format!("{}", text.dimmed())
20    }
21
22    /// Style for primary values (e.g., provider names, model names)
23    pub fn value<T: Display>(text: T) -> String {
24        format!("{}", text.cyan())
25    }
26
27    /// Style for secondary/supplementary info (e.g., endpoints, descriptions)
28    pub fn secondary<T: Display>(text: T) -> String {
29        format!("{}", text.dimmed())
30    }
31
32    /// Style for success messages
33    pub fn success<T: Display>(text: T) -> String {
34        format!("{}", text.green())
35    }
36
37    /// Style for error messages
38    pub fn error<T: Display>(text: T) -> String {
39        format!("{}", text.red().bold())
40    }
41
42    /// Style for warning messages
43    pub fn warning<T: Display>(text: T) -> String {
44        format!("{}", text.yellow())
45    }
46
47    /// Style for commands (e.g., "/config", "/help")
48    pub fn command<T: Display>(text: T) -> String {
49        format!("{}", text.green())
50    }
51
52    /// Style for language codes
53    pub fn code<T: Display>(text: T) -> String {
54        format!("{}", text.yellow())
55    }
56
57    /// Style for hints/help text
58    pub fn hint<T: Display>(text: T) -> String {
59        format!("{}", text.dimmed().italic())
60    }
61
62    /// Style for the default marker
63    pub fn default_marker() -> String {
64        format!("{}", "(default)".dimmed())
65    }
66
67    /// Style for version info
68    pub fn version<T: Display>(text: T) -> String {
69        format!("{}", text.dimmed())
70    }
71}