1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/// Character set configuration for rendering
#[derive(Clone, Copy, Debug)]
pub enum CharsetMode {
Unicode,
Ascii,
}
/// Character definitions for UI elements
#[derive(Clone, Copy, Debug)]
pub struct Charset {
pub mode: CharsetMode,
// Background
pub background: char,
// Window borders
pub border_top_left: char,
pub border_top_right: char,
pub border_bottom_left: char,
pub border_bottom_right: char,
pub border_horizontal: char,
pub border_vertical: char,
// Window controls
pub resize_handle: char,
pub shadow: char,
// Configuration window toggles
pub block: char, // Full block for "on" state
pub shade: char, // Light shade for "off" state
}
impl Charset {
/// Create Unicode charset (default)
pub fn unicode() -> Self {
Self {
mode: CharsetMode::Unicode,
background: '░', // U+2591 light shade (DOS CP437 177)
border_top_left: '╔', // U+2554
border_top_right: '╗', // U+2557
border_bottom_left: '╚', // U+255A
border_bottom_right: '╝', // U+255D
border_horizontal: '═', // U+2550
border_vertical: '║', // U+2551
resize_handle: '╬', // U+256C (DOS CP437 206) box drawings double vertical and horizontal
shadow: '▓', // U+2593 dark shade
block: '█', // U+2588 full block
shade: '░', // U+2591 light shade
}
}
/// Create ASCII-compatible charset
pub fn ascii() -> Self {
Self {
mode: CharsetMode::Ascii,
background: ' ', // Space for clean background
border_top_left: '+', // Plus for corners
border_top_right: '+',
border_bottom_left: '+',
border_bottom_right: '+',
border_horizontal: '-', // Dash for horizontal
border_vertical: '|', // Pipe for vertical
resize_handle: '+', // Plus for resize handle (matches corners)
shadow: '#', // Hash for shadow
block: '#', // Hash for "on" state in ASCII mode
shade: ' ', // Space for "off" state in ASCII mode
}
}
// Accessor methods for border characters
pub fn border_top_left(&self) -> char {
self.border_top_left
}
pub fn border_top_right(&self) -> char {
self.border_top_right
}
pub fn border_bottom_left(&self) -> char {
self.border_bottom_left
}
pub fn border_bottom_right(&self) -> char {
self.border_bottom_right
}
pub fn border_horizontal(&self) -> char {
self.border_horizontal
}
pub fn border_vertical(&self) -> char {
self.border_vertical
}
// Accessor methods for toggle characters
pub fn block(&self) -> char {
self.block
}
pub fn shade(&self) -> char {
self.shade
}
/// Set a custom background character
pub fn set_background(&mut self, background_char: char) {
self.background = background_char;
}
}