Skip to main content

par_term_config/
cell.rs

1/// A single terminal cell with styled content for rendering.
2///
3/// This is the bridge between terminal emulation (core library cells with VT attributes)
4/// and GPU rendering (colored rectangles and textured glyphs). The `TerminalManager`
5/// converts core cells into these, applying theme colors and selection state.
6#[derive(Clone, Debug, PartialEq)]
7pub struct Cell {
8    /// The grapheme cluster displayed in this cell (typically one character or a composed sequence).
9    pub grapheme: String,
10    /// Foreground color as RGBA (0–255 per channel).
11    pub fg_color: [u8; 4],
12    /// Background color as RGBA (0–255 per channel). Alpha 0 means transparent (default background).
13    pub bg_color: [u8; 4],
14    /// Whether to render the cell's font in bold weight.
15    pub bold: bool,
16    /// Whether to render the cell's font in italic style.
17    pub italic: bool,
18    /// Whether to draw an underline below the cell's glyph.
19    pub underline: bool,
20    /// Whether to draw a strikethrough line through the cell's glyph.
21    pub strikethrough: bool,
22    /// Optional OSC 8 hyperlink ID. Non-None cells are clickable and open a URL.
23    pub hyperlink_id: Option<u32>,
24    /// True if this cell holds the left half of a wide (double-width) character.
25    pub wide_char: bool,
26    /// True if this cell is the right-half spacer of a wide character. Has no renderable content.
27    pub wide_char_spacer: bool,
28}
29
30impl Default for Cell {
31    fn default() -> Self {
32        Self {
33            grapheme: " ".to_string(),
34            fg_color: [255, 255, 255, 255],
35            bg_color: [0, 0, 0, 0],
36            bold: false,
37            italic: false,
38            underline: false,
39            strikethrough: false,
40            hyperlink_id: None,
41            wide_char: false,
42            wide_char_spacer: false,
43        }
44    }
45}