use crate::style::Color;
#[derive(Debug, Clone)]
pub struct TuiButtonDefaults {
pub icon_only_width: u16, pub text_padding: u16, pub min_text_width: u16, pub checkbox_width: u16, }
impl Default for TuiButtonDefaults {
fn default() -> Self {
Self {
icon_only_width: 3,
text_padding: 1,
min_text_width: 5,
checkbox_width: 3,
}
}
}
#[derive(Debug, Clone)]
pub struct TuiColors {
pub bg_normal: Color, pub bg_hover: Color, pub bg_pressed: Color, pub bg_active: Color, pub bg_disabled: Color,
pub fg_normal: Color, pub fg_dimmed: Color, pub fg_disabled: Color, pub fg_accent: Color, pub fg_danger: Color, pub fg_warning: Color, pub fg_success: Color, pub fg_info: Color,
pub border_normal: Color, pub border_active: Color, pub border_focused: Color, }
impl Default for TuiColors {
fn default() -> Self {
Self {
bg_normal: Color::Reset,
bg_hover: Color::Indexed(238),
bg_pressed: Color::Indexed(240),
bg_active: Color::Indexed(236),
bg_disabled: Color::Indexed(234),
fg_normal: Color::White,
fg_dimmed: Color::Indexed(245),
fg_disabled: Color::Indexed(242),
fg_accent: Color::Green,
fg_danger: Color::Red,
fg_warning: Color::Yellow,
fg_success: Color::Green,
fg_info: Color::Blue,
border_normal: Color::Indexed(240),
border_active: Color::Green,
border_focused: Color::Blue,
}
}
}
pub struct TuiIcons;
impl TuiIcons {
pub const CLOSE: &'static str = "×";
pub const ADD: &'static str = "+";
pub const CHECK: &'static str = "✓";
pub const CROSS: &'static str = "✗";
pub const CHEVRON_DOWN: &'static str = "▼";
pub const CHEVRON_RIGHT: &'static str = "▶";
pub const CHEVRON_LEFT: &'static str = "◀";
pub const CHEVRON_UP: &'static str = "▲";
pub const CIRCLE_FILLED: &'static str = "●";
pub const CIRCLE_EMPTY: &'static str = "○";
pub const INFO: &'static str = "ℹ";
pub const WARNING: &'static str = "⚠";
pub const SLIDER_FILL: &'static str = "█";
pub const SLIDER_EMPTY: &'static str = "░";
pub const SCROLLBAR_TRACK: &'static str = "║";
pub const SCROLLBAR_THUMB: &'static str = "█";
}
pub fn icon_to_char(icon: &uzor_core::types::IconId) -> &'static str {
match icon.name() {
"close" | "x" => TuiIcons::CLOSE,
"add" | "plus" => TuiIcons::ADD,
"check" | "checkmark" => TuiIcons::CHECK,
"search" => "🔍",
"settings" | "gear" => "⚙",
"eye" => "👁",
"eye_off" | "eye-off" => "⊗",
"chevron_down" | "chevron-down" => TuiIcons::CHEVRON_DOWN,
"chevron_right" | "chevron-right" => TuiIcons::CHEVRON_RIGHT,
"chevron_left" | "chevron-left" => TuiIcons::CHEVRON_LEFT,
"chevron_up" | "chevron-up" => TuiIcons::CHEVRON_UP,
"trash" | "delete" => "🗑",
"lock" => "🔒",
"unlock" => "🔓",
"alert" | "bell" => "🔔",
"more" | "dots" => "•••",
_ => "•",
}
}