ratatui_toolkit/markdown_renderer/
markdown_style.rs

1use ratatui::style::Color;
2
3/// Configuration for markdown rendering styles
4#[derive(Clone)]
5pub struct MarkdownStyle {
6    pub h1_icon: &'static str,
7    pub h2_icon: &'static str,
8    pub h3_icon: &'static str,
9    pub h4_icon: &'static str,
10    pub h5_icon: &'static str,
11    pub h6_icon: &'static str,
12
13    pub h1_fg: Color,
14    pub h1_bg: Color,
15    pub h2_fg: Color,
16    pub h2_bg: Color,
17    pub h3_fg: Color,
18    pub h3_bg: Color,
19
20    pub bullet_l1: &'static str,
21    pub bullet_l2: &'static str,
22    pub bullet_l3: &'static str,
23
24    pub code_block_border: bool,
25    pub code_block_bg: Color,
26    pub inline_code_bg: Color,
27    pub inline_code_fg: Color,
28
29    pub quote_icon: &'static str,
30    pub quote_fg: Color,
31    pub quote_bg: Color,
32
33    pub callout_note_icon: &'static str,
34    pub callout_tip_icon: &'static str,
35    pub callout_warning_icon: &'static str,
36    pub callout_caution_icon: &'static str,
37}
38
39impl Default for MarkdownStyle {
40    fn default() -> Self {
41        Self {
42            // Heading icons (matching render-markdown.nvim defaults)
43            h1_icon: "󰲡 ",
44            h2_icon: "󰲣 ",
45            h3_icon: "󰲥 ",
46            h4_icon: "󰲧 ",
47            h5_icon: "󰲩 ",
48            h6_icon: "󰲫 ",
49
50            // Heading colors matching render-markdown.nvim with typical colorscheme
51            // H1 = DiffAdd (blue in your screenshot)
52            h1_fg: Color::Rgb(255, 255, 255),
53            h1_bg: Color::Rgb(30, 58, 138), // Deep blue
54            // H2 = DiffChange (cyan/teal in your screenshot)
55            h2_fg: Color::Rgb(255, 255, 255),
56            h2_bg: Color::Rgb(8, 145, 178), // Cyan/teal
57            // H3 = DiffDelete (purple/magenta in your screenshot)
58            h3_fg: Color::Rgb(255, 255, 255),
59            h3_bg: Color::Rgb(168, 85, 247), // Purple/magenta
60
61            // Bullet points
62            bullet_l1: "● ",
63            bullet_l2: "○ ",
64            bullet_l3: "◆ ",
65
66            // Code blocks
67            code_block_border: true,
68            code_block_bg: Color::Rgb(40, 42, 54),
69            inline_code_bg: Color::Rgb(68, 71, 90),
70            inline_code_fg: Color::Rgb(139, 233, 253),
71
72            // Block quotes
73            quote_icon: "▐ ",
74            quote_fg: Color::Rgb(139, 233, 253),
75            quote_bg: Color::Rgb(40, 42, 54),
76
77            // Callouts
78            callout_note_icon: "󰋽 ",
79            callout_tip_icon: "󰌶 ",
80            callout_warning_icon: "󰀪 ",
81            callout_caution_icon: "󰳦 ",
82        }
83    }
84}