Debian Codegraph @

helix-tui/src/symbols.rs

raw symbols SCIP
1 //! Common TUI symbols including blocks, bars, braille, lines
2
3 pub mod block {
4 pub const FULL: &str = "█";
5 pub const SEVEN_EIGHTHS: &str = "▉";
6 pub const THREE_QUARTERS: &str = "▊";
7 pub const FIVE_EIGHTHS: &str = "▋";
8 pub const HALF: &str = "▌";
9 pub const THREE_EIGHTHS: &str = "▍";
10 pub const ONE_QUARTER: &str = "▎";
11 pub const ONE_EIGHTH: &str = "▏";
12
13 #[derive(Debug, Clone)]
14 pub struct Set {
15 pub full: &'static str,
16 pub seven_eighths: &'static str,
17 pub three_quarters: &'static str,
18 pub five_eighths: &'static str,
19 pub half: &'static str,
20 pub three_eighths: &'static str,
21 pub one_quarter: &'static str,
22 pub one_eighth: &'static str,
23 pub empty: &'static str,
24 }
25
26 pub const THREE_LEVELS: Set = Set {
27 full: FULL,
28 seven_eighths: FULL,
29 three_quarters: HALF,
30 five_eighths: HALF,
31 half: HALF,
32 three_eighths: HALF,
33 one_quarter: HALF,
34 one_eighth: " ",
35 empty: " ",
36 };
37
38 pub const NINE_LEVELS: Set = Set {
39 full: FULL,
40 seven_eighths: SEVEN_EIGHTHS,
41 three_quarters: THREE_QUARTERS,
42 five_eighths: FIVE_EIGHTHS,
43 half: HALF,
44 three_eighths: THREE_EIGHTHS,
45 one_quarter: ONE_QUARTER,
46 one_eighth: ONE_EIGHTH,
47 empty: " ",
48 };
49 }
50
51 pub mod bar {
52 pub const FULL: &str = "█";
53 pub const SEVEN_EIGHTHS: &str = "▇";
54 pub const THREE_QUARTERS: &str = "▆";
55 pub const FIVE_EIGHTHS: &str = "▅";
56 pub const HALF: &str = "▄";
57 pub const THREE_EIGHTHS: &str = "▃";
58 pub const ONE_QUARTER: &str = "▂";
59 pub const ONE_EIGHTH: &str = "▁";
60
61 #[derive(Debug, Clone)]
62 pub struct Set {
63 pub full: &'static str,
64 pub seven_eighths: &'static str,
65 pub three_quarters: &'static str,
66 pub five_eighths: &'static str,
67 pub half: &'static str,
68 pub three_eighths: &'static str,
69 pub one_quarter: &'static str,
70 pub one_eighth: &'static str,
71 pub empty: &'static str,
72 }
73
74 pub const THREE_LEVELS: Set = Set {
75 full: FULL,
76 seven_eighths: FULL,
77 three_quarters: HALF,
78 five_eighths: HALF,
79 half: HALF,
80 three_eighths: HALF,
81 one_quarter: HALF,
82 one_eighth: " ",
83 empty: " ",
84 };
85
86 pub const NINE_LEVELS: Set = Set {
87 full: FULL,
88 seven_eighths: SEVEN_EIGHTHS,
89 three_quarters: THREE_QUARTERS,
90 five_eighths: FIVE_EIGHTHS,
91 half: HALF,
92 three_eighths: THREE_EIGHTHS,
93 one_quarter: ONE_QUARTER,
94 one_eighth: ONE_EIGHTH,
95 empty: " ",
96 };
97 }
98
99 pub mod line {
100 pub const VERTICAL: &str = "│";
101 pub const DOUBLE_VERTICAL: &str = "║";
102 pub const THICK_VERTICAL: &str = "┃";
103
104 pub const HORIZONTAL: &str = "─";
105 pub const DOUBLE_HORIZONTAL: &str = "═";
106 pub const THICK_HORIZONTAL: &str = "━";
107
108 pub const TOP_RIGHT: &str = "┐";
109 pub const ROUNDED_TOP_RIGHT: &str = "╮";
110 pub const DOUBLE_TOP_RIGHT: &str = "╗";
111 pub const THICK_TOP_RIGHT: &str = "┓";
112
113 pub const TOP_LEFT: &str = "┌";
114 pub const ROUNDED_TOP_LEFT: &str = "╭";
115 pub const DOUBLE_TOP_LEFT: &str = "╔";
116 pub const THICK_TOP_LEFT: &str = "┏";
117
118 pub const BOTTOM_RIGHT: &str = "┘";
119 pub const ROUNDED_BOTTOM_RIGHT: &str = "╯";
120 pub const DOUBLE_BOTTOM_RIGHT: &str = "╝";
121 pub const THICK_BOTTOM_RIGHT: &str = "┛";
122
123 pub const BOTTOM_LEFT: &str = "└";
124 pub const ROUNDED_BOTTOM_LEFT: &str = "╰";
125 pub const DOUBLE_BOTTOM_LEFT: &str = "╚";
126 pub const THICK_BOTTOM_LEFT: &str = "┗";
127
128 pub const VERTICAL_LEFT: &str = "┤";
129 pub const DOUBLE_VERTICAL_LEFT: &str = "╣";
130 pub const THICK_VERTICAL_LEFT: &str = "┫";
131
132 pub const VERTICAL_RIGHT: &str = "├";
133 pub const DOUBLE_VERTICAL_RIGHT: &str = "╠";
134 pub const THICK_VERTICAL_RIGHT: &str = "┣";
135
136 pub const HORIZONTAL_DOWN: &str = "┬";
137 pub const DOUBLE_HORIZONTAL_DOWN: &str = "╦";
138 pub const THICK_HORIZONTAL_DOWN: &str = "┳";
139
140 pub const HORIZONTAL_UP: &str = "┴";
141 pub const DOUBLE_HORIZONTAL_UP: &str = "╩";
142 pub const THICK_HORIZONTAL_UP: &str = "┻";
143
144 pub const CROSS: &str = "┼";
145 pub const DOUBLE_CROSS: &str = "╬";
146 pub const THICK_CROSS: &str = "╋";
147
148 #[derive(Debug, Clone)]
149 pub struct Set {
150 pub vertical: &'static str,
151 pub horizontal: &'static str,
152 pub top_right: &'static str,
153 pub top_left: &'static str,
154 pub bottom_right: &'static str,
155 pub bottom_left: &'static str,
156 pub vertical_left: &'static str,
157 pub vertical_right: &'static str,
158 pub horizontal_down: &'static str,
159 pub horizontal_up: &'static str,
160 pub cross: &'static str,
161 }
162
163 pub const NORMAL: Set = Set {
164 vertical: VERTICAL,
165 horizontal: HORIZONTAL,
166 top_right: TOP_RIGHT,
167 top_left: TOP_LEFT,
168 bottom_right: BOTTOM_RIGHT,
169 bottom_left: BOTTOM_LEFT,
170 vertical_left: VERTICAL_LEFT,
171 vertical_right: VERTICAL_RIGHT,
172 horizontal_down: HORIZONTAL_DOWN,
173 horizontal_up: HORIZONTAL_UP,
174 cross: CROSS,
175 };
176
177 pub const ROUNDED: Set = Set {
178 top_right: ROUNDED_TOP_RIGHT,
179 top_left: ROUNDED_TOP_LEFT,
180 bottom_right: ROUNDED_BOTTOM_RIGHT,
181 bottom_left: ROUNDED_BOTTOM_LEFT,
182 ..NORMAL
183 };
184
185 pub const DOUBLE: Set = Set {
186 vertical: DOUBLE_VERTICAL,
187 horizontal: DOUBLE_HORIZONTAL,
188 top_right: DOUBLE_TOP_RIGHT,
189 top_left: DOUBLE_TOP_LEFT,
190 bottom_right: DOUBLE_BOTTOM_RIGHT,
191 bottom_left: DOUBLE_BOTTOM_LEFT,
192 vertical_left: DOUBLE_VERTICAL_LEFT,
193 vertical_right: DOUBLE_VERTICAL_RIGHT,
194 horizontal_down: DOUBLE_HORIZONTAL_DOWN,
195 horizontal_up: DOUBLE_HORIZONTAL_UP,
196 cross: DOUBLE_CROSS,
197 };
198
199 pub const THICK: Set = Set {
200 vertical: THICK_VERTICAL,
201 horizontal: THICK_HORIZONTAL,
202 top_right: THICK_TOP_RIGHT,
203 top_left: THICK_TOP_LEFT,
204 bottom_right: THICK_BOTTOM_RIGHT,
205 bottom_left: THICK_BOTTOM_LEFT,
206 vertical_left: THICK_VERTICAL_LEFT,
207 vertical_right: THICK_VERTICAL_RIGHT,
208 horizontal_down: THICK_HORIZONTAL_DOWN,
209 horizontal_up: THICK_HORIZONTAL_UP,
210 cross: THICK_CROSS,
211 };
212 }
213
214 pub const DOT: &str = "•";
215
216 pub mod braille {
217 pub const BLANK: u16 = 0x2800;
218 pub const DOTS: [[u16; 2]; 4] = [
219 [0x0001, 0x0008],
220 [0x0002, 0x0010],
221 [0x0004, 0x0020],
222 [0x0040, 0x0080],
223 ];
224 }
225
226 /// Marker to use when plotting data points
227 #[derive(Debug, Clone, Copy)]
228 pub enum Marker {
229 /// One point per cell in shape of dot
230 Dot,
231 /// One point per cell in shape of a block
232 Block,
233 /// Up to 8 points per cell
234 Braille,
235 }