Files
Cagire/crates/markdown/src/theme.rs
Raphaël Forment b47c789612
Some checks failed
Deploy Website / deploy (push) Failing after 4m48s
Feat: continue refactoring
2026-02-01 13:39:25 +01:00

78 lines
1.7 KiB
Rust

use ratatui::style::{Color, Modifier, Style};
pub trait MarkdownTheme {
fn h1(&self) -> Style;
fn h2(&self) -> Style;
fn h3(&self) -> Style;
fn text(&self) -> Style;
fn code(&self) -> Style;
fn code_border(&self) -> Style;
fn link(&self) -> Style;
fn link_url(&self) -> Style;
fn quote(&self) -> Style;
fn list(&self) -> Style;
fn table_header_bg(&self) -> Color;
fn table_row_even(&self) -> Color;
fn table_row_odd(&self) -> Color;
}
pub struct DefaultTheme;
impl MarkdownTheme for DefaultTheme {
fn h1(&self) -> Style {
Style::new()
.fg(Color::Cyan)
.add_modifier(Modifier::BOLD | Modifier::UNDERLINED)
}
fn h2(&self) -> Style {
Style::new().fg(Color::Blue).add_modifier(Modifier::BOLD)
}
fn h3(&self) -> Style {
Style::new().fg(Color::Magenta).add_modifier(Modifier::BOLD)
}
fn text(&self) -> Style {
Style::new().fg(Color::White)
}
fn code(&self) -> Style {
Style::new().fg(Color::Yellow)
}
fn code_border(&self) -> Style {
Style::new().fg(Color::DarkGray)
}
fn link(&self) -> Style {
Style::new()
.fg(Color::Blue)
.add_modifier(Modifier::UNDERLINED)
}
fn link_url(&self) -> Style {
Style::new().fg(Color::DarkGray)
}
fn quote(&self) -> Style {
Style::new().fg(Color::Gray)
}
fn list(&self) -> Style {
Style::new().fg(Color::White)
}
fn table_header_bg(&self) -> Color {
Color::DarkGray
}
fn table_row_even(&self) -> Color {
Color::Reset
}
fn table_row_odd(&self) -> Color {
Color::Reset
}
}