1use super::{UnicodeProvider, UnicodeTheme};
5
6#[derive(Debug, Clone, Copy)]
8pub enum Border {
9 Horizontal,
11 Vertical,
13 TopLeft,
15 TopRight,
17 BottomLeft,
19 BottomRight,
21 Cross,
23 TeeUp,
25 TeeDown,
27 TeeLeft,
29 TeeRight,
31}
32
33impl UnicodeProvider for Border {
34 fn get_char(&self, theme: UnicodeTheme) -> char {
35 match (self, theme) {
36 (Border::Horizontal, UnicodeTheme::Minimal) => '-',
37 (Border::Horizontal, UnicodeTheme::Basic) => '-',
38 (Border::Horizontal, UnicodeTheme::Rich) => '─',
39 (Border::Horizontal, UnicodeTheme::Fancy) => '━',
40
41 (Border::Vertical, UnicodeTheme::Minimal) => '|',
42 (Border::Vertical, UnicodeTheme::Basic) => '|',
43 (Border::Vertical, UnicodeTheme::Rich) => '│',
44 (Border::Vertical, UnicodeTheme::Fancy) => '┃',
45
46 (Border::TopLeft, UnicodeTheme::Minimal) => '+',
47 (Border::TopLeft, UnicodeTheme::Basic) => '+',
48 (Border::TopLeft, UnicodeTheme::Rich) => '┌',
49 (Border::TopLeft, UnicodeTheme::Fancy) => '┏',
50
51 (Border::TopRight, UnicodeTheme::Minimal) => '+',
52 (Border::TopRight, UnicodeTheme::Basic) => '+',
53 (Border::TopRight, UnicodeTheme::Rich) => '┐',
54 (Border::TopRight, UnicodeTheme::Fancy) => '┓',
55
56 (Border::BottomLeft, UnicodeTheme::Minimal) => '+',
57 (Border::BottomLeft, UnicodeTheme::Basic) => '+',
58 (Border::BottomLeft, UnicodeTheme::Rich) => '└',
59 (Border::BottomLeft, UnicodeTheme::Fancy) => '┗',
60
61 (Border::BottomRight, UnicodeTheme::Minimal) => '+',
62 (Border::BottomRight, UnicodeTheme::Basic) => '+',
63 (Border::BottomRight, UnicodeTheme::Rich) => '┘',
64 (Border::BottomRight, UnicodeTheme::Fancy) => '┛',
65
66 (Border::Cross, UnicodeTheme::Minimal) => '+',
67 (Border::Cross, UnicodeTheme::Basic) => '+',
68 (Border::Cross, UnicodeTheme::Rich) => '┼',
69 (Border::Cross, UnicodeTheme::Fancy) => '╋',
70
71 (Border::TeeUp, UnicodeTheme::Minimal) => '+',
72 (Border::TeeUp, UnicodeTheme::Basic) => '+',
73 (Border::TeeUp, UnicodeTheme::Rich) => '┴',
74 (Border::TeeUp, UnicodeTheme::Fancy) => '┻',
75
76 (Border::TeeDown, UnicodeTheme::Minimal) => '+',
77 (Border::TeeDown, UnicodeTheme::Basic) => '+',
78 (Border::TeeDown, UnicodeTheme::Rich) => '┬',
79 (Border::TeeDown, UnicodeTheme::Fancy) => '┳',
80
81 (Border::TeeLeft, UnicodeTheme::Minimal) => '+',
82 (Border::TeeLeft, UnicodeTheme::Basic) => '+',
83 (Border::TeeLeft, UnicodeTheme::Rich) => '┤',
84 (Border::TeeLeft, UnicodeTheme::Fancy) => '┫',
85
86 (Border::TeeRight, UnicodeTheme::Minimal) => '+',
87 (Border::TeeRight, UnicodeTheme::Basic) => '+',
88 (Border::TeeRight, UnicodeTheme::Rich) => '├',
89 (Border::TeeRight, UnicodeTheme::Fancy) => '┣',
90 }
91 }
92}
93
94#[derive(Debug, Clone, Copy)]
96pub enum Control {
97 CheckboxUnchecked,
99 CheckboxChecked,
101 RadioUnselected,
103 RadioSelected,
105 Button,
107 MenuItem,
109 DropdownArrow,
111 ExpandCollapsed,
113 ExpandExpanded,
115 Loading,
117 Close,
119 Minimize,
121 Maximize,
123}
124
125impl UnicodeProvider for Control {
126 fn get_char(&self, theme: UnicodeTheme) -> char {
127 match (self, theme) {
128 (Control::CheckboxUnchecked, UnicodeTheme::Minimal) => '[',
129 (Control::CheckboxUnchecked, UnicodeTheme::Basic) => '☐',
130 (Control::CheckboxUnchecked, UnicodeTheme::Rich) => '☐',
131 (Control::CheckboxUnchecked, UnicodeTheme::Fancy) => '🔲',
132
133 (Control::CheckboxChecked, UnicodeTheme::Minimal) => 'X',
134 (Control::CheckboxChecked, UnicodeTheme::Basic) => '☑',
135 (Control::CheckboxChecked, UnicodeTheme::Rich) => '☑',
136 (Control::CheckboxChecked, UnicodeTheme::Fancy) => '✅',
137
138 (Control::RadioUnselected, UnicodeTheme::Minimal) => '(',
139 (Control::RadioUnselected, UnicodeTheme::Basic) => '○',
140 (Control::RadioUnselected, UnicodeTheme::Rich) => '○',
141 (Control::RadioUnselected, UnicodeTheme::Fancy) => '⚪',
142
143 (Control::RadioSelected, UnicodeTheme::Minimal) => '*',
144 (Control::RadioSelected, UnicodeTheme::Basic) => '●',
145 (Control::RadioSelected, UnicodeTheme::Rich) => '●',
146 (Control::RadioSelected, UnicodeTheme::Fancy) => '🔘',
147
148 (Control::Button, UnicodeTheme::Minimal) => '[',
149 (Control::Button, UnicodeTheme::Basic) => '▢',
150 (Control::Button, UnicodeTheme::Rich) => '▢',
151 (Control::Button, UnicodeTheme::Fancy) => '🔳',
152
153 (Control::MenuItem, UnicodeTheme::Minimal) => '-',
154 (Control::MenuItem, UnicodeTheme::Basic) => '•',
155 (Control::MenuItem, UnicodeTheme::Rich) => '▸',
156 (Control::MenuItem, UnicodeTheme::Fancy) => '🔸',
157
158 (Control::DropdownArrow, UnicodeTheme::Minimal) => 'v',
159 (Control::DropdownArrow, UnicodeTheme::Basic) => '▼',
160 (Control::DropdownArrow, UnicodeTheme::Rich) => '▼',
161 (Control::DropdownArrow, UnicodeTheme::Fancy) => '🔽',
162
163 (Control::ExpandCollapsed, UnicodeTheme::Minimal) => '>',
164 (Control::ExpandCollapsed, UnicodeTheme::Basic) => '▶',
165 (Control::ExpandCollapsed, UnicodeTheme::Rich) => '▶',
166 (Control::ExpandCollapsed, UnicodeTheme::Fancy) => '▶',
167
168 (Control::ExpandExpanded, UnicodeTheme::Minimal) => 'v',
169 (Control::ExpandExpanded, UnicodeTheme::Basic) => '▼',
170 (Control::ExpandExpanded, UnicodeTheme::Rich) => '▼',
171 (Control::ExpandExpanded, UnicodeTheme::Fancy) => '🔽',
172
173 (Control::Loading, UnicodeTheme::Minimal) => '|',
174 (Control::Loading, UnicodeTheme::Basic) => '◐',
175 (Control::Loading, UnicodeTheme::Rich) => '◐',
176 (Control::Loading, UnicodeTheme::Fancy) => '🔄',
177
178 (Control::Close, UnicodeTheme::Minimal) => 'X',
179 (Control::Close, UnicodeTheme::Basic) => '✕',
180 (Control::Close, UnicodeTheme::Rich) => '✕',
181 (Control::Close, UnicodeTheme::Fancy) => '❌',
182
183 (Control::Minimize, UnicodeTheme::Minimal) => '_',
184 (Control::Minimize, UnicodeTheme::Basic) => '−',
185 (Control::Minimize, UnicodeTheme::Rich) => '−',
186 (Control::Minimize, UnicodeTheme::Fancy) => '➖',
187
188 (Control::Maximize, UnicodeTheme::Minimal) => '^',
189 (Control::Maximize, UnicodeTheme::Basic) => '□',
190 (Control::Maximize, UnicodeTheme::Rich) => '□',
191 (Control::Maximize, UnicodeTheme::Fancy) => '⬜',
192 }
193 }
194}
195
196#[derive(Debug, Clone, Copy)]
198pub enum Separator {
199 Thin,
201 Thick,
203 Dotted,
205 Dashed,
207 Double,
209 Wavy,
211}
212
213impl UnicodeProvider for Separator {
214 fn get_char(&self, theme: UnicodeTheme) -> char {
215 match (self, theme) {
216 (Separator::Thin, UnicodeTheme::Minimal) => '-',
217 (Separator::Thin, UnicodeTheme::Basic) => '─',
218 (Separator::Thin, UnicodeTheme::Rich) => '─',
219 (Separator::Thin, UnicodeTheme::Fancy) => '─',
220
221 (Separator::Thick, UnicodeTheme::Minimal) => '=',
222 (Separator::Thick, UnicodeTheme::Basic) => '━',
223 (Separator::Thick, UnicodeTheme::Rich) => '━',
224 (Separator::Thick, UnicodeTheme::Fancy) => '━',
225
226 (Separator::Dotted, UnicodeTheme::Minimal) => '.',
227 (Separator::Dotted, UnicodeTheme::Basic) => '┄',
228 (Separator::Dotted, UnicodeTheme::Rich) => '┄',
229 (Separator::Dotted, UnicodeTheme::Fancy) => '┈',
230
231 (Separator::Dashed, UnicodeTheme::Minimal) => '-',
232 (Separator::Dashed, UnicodeTheme::Basic) => '┅',
233 (Separator::Dashed, UnicodeTheme::Rich) => '┅',
234 (Separator::Dashed, UnicodeTheme::Fancy) => '┉',
235
236 (Separator::Double, UnicodeTheme::Minimal) => '=',
237 (Separator::Double, UnicodeTheme::Basic) => '═',
238 (Separator::Double, UnicodeTheme::Rich) => '═',
239 (Separator::Double, UnicodeTheme::Fancy) => '═',
240
241 (Separator::Wavy, UnicodeTheme::Minimal) => '~',
242 (Separator::Wavy, UnicodeTheme::Basic) => '〜',
243 (Separator::Wavy, UnicodeTheme::Rich) => '〜',
244 (Separator::Wavy, UnicodeTheme::Fancy) => '〰',
245 }
246 }
247}
248
249#[derive(Debug, Clone, Copy)]
251pub enum Indicator {
252 Success,
254 Warning,
256 Error,
258 Info,
260 Question,
262 Attention,
264 Progress,
266 Complete,
268 Pending,
270 Active,
272 Inactive,
274}
275
276impl UnicodeProvider for Indicator {
277 fn get_char(&self, theme: UnicodeTheme) -> char {
278 match (self, theme) {
279 (Indicator::Success, UnicodeTheme::Minimal) => '+',
280 (Indicator::Success, UnicodeTheme::Basic) => '✓',
281 (Indicator::Success, UnicodeTheme::Rich) => '✓',
282 (Indicator::Success, UnicodeTheme::Fancy) => '✅',
283
284 (Indicator::Warning, UnicodeTheme::Minimal) => '!',
285 (Indicator::Warning, UnicodeTheme::Basic) => '⚠',
286 (Indicator::Warning, UnicodeTheme::Rich) => '⚠',
287 (Indicator::Warning, UnicodeTheme::Fancy) => '⚠',
288
289 (Indicator::Error, UnicodeTheme::Minimal) => 'X',
290 (Indicator::Error, UnicodeTheme::Basic) => '✗',
291 (Indicator::Error, UnicodeTheme::Rich) => '✗',
292 (Indicator::Error, UnicodeTheme::Fancy) => '❌',
293
294 (Indicator::Info, UnicodeTheme::Minimal) => 'i',
295 (Indicator::Info, UnicodeTheme::Basic) => 'ℹ',
296 (Indicator::Info, UnicodeTheme::Rich) => 'ℹ',
297 (Indicator::Info, UnicodeTheme::Fancy) => 'ℹ',
298
299 (Indicator::Question, UnicodeTheme::Minimal) => '?',
300 (Indicator::Question, UnicodeTheme::Basic) => '?',
301 (Indicator::Question, UnicodeTheme::Rich) => '❓',
302 (Indicator::Question, UnicodeTheme::Fancy) => '❓',
303
304 (Indicator::Attention, UnicodeTheme::Minimal) => '*',
305 (Indicator::Attention, UnicodeTheme::Basic) => '●',
306 (Indicator::Attention, UnicodeTheme::Rich) => '●',
307 (Indicator::Attention, UnicodeTheme::Fancy) => '🔴',
308
309 (Indicator::Progress, UnicodeTheme::Minimal) => '.',
310 (Indicator::Progress, UnicodeTheme::Basic) => '◐',
311 (Indicator::Progress, UnicodeTheme::Rich) => '◐',
312 (Indicator::Progress, UnicodeTheme::Fancy) => '🔄',
313
314 (Indicator::Complete, UnicodeTheme::Minimal) => '*',
315 (Indicator::Complete, UnicodeTheme::Basic) => '●',
316 (Indicator::Complete, UnicodeTheme::Rich) => '●',
317 (Indicator::Complete, UnicodeTheme::Fancy) => '🟢',
318
319 (Indicator::Pending, UnicodeTheme::Minimal) => 'o',
320 (Indicator::Pending, UnicodeTheme::Basic) => '○',
321 (Indicator::Pending, UnicodeTheme::Rich) => '○',
322 (Indicator::Pending, UnicodeTheme::Fancy) => '⚪',
323
324 (Indicator::Active, UnicodeTheme::Minimal) => '*',
325 (Indicator::Active, UnicodeTheme::Basic) => '●',
326 (Indicator::Active, UnicodeTheme::Rich) => '●',
327 (Indicator::Active, UnicodeTheme::Fancy) => '🟢',
328
329 (Indicator::Inactive, UnicodeTheme::Minimal) => 'o',
330 (Indicator::Inactive, UnicodeTheme::Basic) => '○',
331 (Indicator::Inactive, UnicodeTheme::Rich) => '○',
332 (Indicator::Inactive, UnicodeTheme::Fancy) => '⚪',
333 }
334 }
335}
336
337pub mod chars {
339 use super::*;
340
341 pub const HORIZONTAL: Border = Border::Horizontal;
343 pub const VERTICAL: Border = Border::Vertical;
344 pub const TOP_LEFT: Border = Border::TopLeft;
345 pub const TOP_RIGHT: Border = Border::TopRight;
346 pub const BOTTOM_LEFT: Border = Border::BottomLeft;
347 pub const BOTTOM_RIGHT: Border = Border::BottomRight;
348 pub const CROSS: Border = Border::Cross;
349
350 pub const CHECKBOX_UNCHECKED: Control = Control::CheckboxUnchecked;
352 pub const CHECKBOX_CHECKED: Control = Control::CheckboxChecked;
353 pub const RADIO_UNSELECTED: Control = Control::RadioUnselected;
354 pub const RADIO_SELECTED: Control = Control::RadioSelected;
355 pub const BUTTON: Control = Control::Button;
356 pub const MENU_ITEM: Control = Control::MenuItem;
357 pub const DROPDOWN_ARROW: Control = Control::DropdownArrow;
358 pub const EXPAND_COLLAPSED: Control = Control::ExpandCollapsed;
359 pub const EXPAND_EXPANDED: Control = Control::ExpandExpanded;
360 pub const LOADING: Control = Control::Loading;
361 pub const CLOSE: Control = Control::Close;
362 pub const MINIMIZE: Control = Control::Minimize;
363 pub const MAXIMIZE: Control = Control::Maximize;
364
365 pub const SEPARATOR_THIN: Separator = Separator::Thin;
367 pub const SEPARATOR_THICK: Separator = Separator::Thick;
368 pub const SEPARATOR_DOTTED: Separator = Separator::Dotted;
369 pub const SEPARATOR_DASHED: Separator = Separator::Dashed;
370 pub const SEPARATOR_DOUBLE: Separator = Separator::Double;
371 pub const SEPARATOR_WAVY: Separator = Separator::Wavy;
372
373 pub const SUCCESS: Indicator = Indicator::Success;
375 pub const WARNING: Indicator = Indicator::Warning;
376 pub const ERROR: Indicator = Indicator::Error;
377 pub const INFO: Indicator = Indicator::Info;
378 pub const QUESTION: Indicator = Indicator::Question;
379 pub const ATTENTION: Indicator = Indicator::Attention;
380 pub const PROGRESS: Indicator = Indicator::Progress;
381 pub const COMPLETE: Indicator = Indicator::Complete;
382 pub const PENDING: Indicator = Indicator::Pending;
383 pub const ACTIVE: Indicator = Indicator::Active;
384 pub const INACTIVE: Indicator = Indicator::Inactive;
385}