chore: refactor CLI app with new modules for seperation of concerns, reusable components and consistent styling

This commit is contained in:
Michel de Graaf
2025-11-12 02:02:35 +01:00
parent 5a28452c02
commit 5816d9b632
11 changed files with 1075 additions and 1034 deletions
+49
View File
@@ -0,0 +1,49 @@
// Reusable styles and colors for consistent UI appearance
#![allow(dead_code)]
use ratatui::style::{Color, Modifier, Style};
// Color scheme
pub const COLOR_PRIMARY: Color = Color::Cyan;
pub const COLOR_SUCCESS: Color = Color::Green;
pub const COLOR_WARNING: Color = Color::Yellow;
pub const COLOR_ERROR: Color = Color::Red;
pub const COLOR_INACTIVE: Color = Color::Gray;
pub const COLOR_BACKGROUND: Color = Color::DarkGray;
pub const COLOR_HIGHLIGHT_BG: Color = Color::Magenta;
pub const COLOR_HIGHLIGHT_FG: Color = Color::Black;
// Reusable styles
pub fn header_style() -> Style {
Style::default()
.fg(COLOR_PRIMARY)
.bg(COLOR_BACKGROUND)
.add_modifier(Modifier::BOLD)
}
pub fn highlight_style() -> Style {
Style::default()
.bg(COLOR_HIGHLIGHT_BG)
.fg(COLOR_HIGHLIGHT_FG)
.add_modifier(Modifier::BOLD)
}
pub fn success_style() -> Style {
Style::default().fg(COLOR_SUCCESS)
}
pub fn warning_style() -> Style {
Style::default().fg(COLOR_WARNING)
}
pub fn error_style() -> Style {
Style::default().fg(COLOR_ERROR)
}
pub fn inactive_style() -> Style {
Style::default().fg(COLOR_INACTIVE)
}
pub fn primary_style() -> Style {
Style::default().fg(COLOR_PRIMARY)
}