Skip to main content

edb_tui/ui/
colors.rs

1// EDB - Ethereum Debugger
2// Copyright (C) 2024 Zhuo Zhang and Wuqi Zhang
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Affero General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Affero General Public License for more details.
13//
14// You should have received a copy of the GNU Affero General Public License
15// along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17//! Color schemes and theming system
18//!
19//! This module provides comprehensive color schemes for the TUI,
20//! including multiple professional themes and semantic color mapping.
21
22use ratatui::style::Color;
23use serde::{Deserialize, Serialize};
24
25/// Semantic color mapping for consistent theming across the entire TUI interface
26#[derive(Debug, Clone)]
27pub struct ColorScheme {
28    // Panel states
29    /// Border color for the currently focused panel
30    pub focused_border: Color,
31    /// Border color for unfocused panels
32    pub unfocused_border: Color,
33    /// Background color for all panels
34    pub panel_bg: Color,
35
36    // Code highlighting
37    /// Color for programming language keywords
38    pub keyword_color: Color,
39    /// Color for string literals in code
40    pub string_color: Color,
41    /// Color for code comments
42    pub comment_color: Color,
43    /// Color for numeric literals
44    pub number_color: Color,
45    /// Color for variable and function identifiers
46    pub identifier_color: Color,
47    /// Color for operators and symbols
48    pub operator_color: Color,
49
50    // Line numbers
51    /// Color for line numbers in code editor
52    pub line_number: Color,
53    /// Background color for line number area
54    pub line_number_bg: Color,
55
56    // Syntax highlighting (detailed)
57    /// Color for language keywords in detailed syntax highlighting
58    pub syntax_keyword_color: Color,
59    /// Color for type definitions and type names
60    pub syntax_type_color: Color,
61    /// Color for string literals in detailed highlighting
62    pub syntax_string_color: Color,
63    /// Color for numbers in detailed highlighting
64    pub syntax_number_color: Color,
65    /// Color for comments in detailed highlighting
66    pub syntax_comment_color: Color,
67    /// Color for identifiers in detailed highlighting
68    pub syntax_identifier_color: Color,
69    /// Color for operators in detailed highlighting
70    pub syntax_operator_color: Color,
71    /// Color for punctuation marks and delimiters
72    pub syntax_punctuation_color: Color,
73    /// Color for Ethereum addresses
74    pub syntax_address_color: Color,
75    /// Color for Solidity pragma statements
76    pub syntax_pragma_color: Color,
77    /// Color for EVM opcodes
78    pub syntax_opcode_color: Color,
79
80    // General highlighting
81    /// Background color for highlighted text areas
82    pub highlight_bg: Color,
83    /// Foreground color for highlighted text
84    pub highlight_fg: Color,
85
86    // Help and UI text
87    /// Color for help text and documentation
88    pub help_text_color: Color,
89
90    // Debugging states
91    /// Background color for the currently executing line
92    pub current_line_bg: Color,
93    /// Foreground color for the currently executing line
94    pub current_line_fg: Color,
95    /// Color for breakpoint indicators
96    pub breakpoint_color: Color,
97    /// Color for error messages and indicators
98    pub error_color: Color,
99    /// Color for success messages and indicators
100    pub success_color: Color,
101    /// Color for warning messages and indicators
102    pub warning_color: Color,
103    /// Color for informational messages and indicators
104    pub info_color: Color,
105
106    // Trace visualization
107    /// Color for function call entries in trace view
108    pub call_color: Color,
109    /// Color for function return entries in trace view
110    pub return_color: Color,
111    /// Color for transaction revert entries in trace view
112    pub revert_color: Color,
113    /// Color for contract creation entries in trace view
114    pub create_color: Color,
115
116    // Terminal
117    /// Color for command prompt in terminal
118    pub prompt_color: Color,
119    /// Color for user input commands in terminal
120    pub command_color: Color,
121    /// Color for command output in terminal
122    pub output_color: Color,
123    /// Color for the terminal cursor
124    pub cursor_color: Color,
125
126    // Interactive elements
127    /// Background color for selected items
128    pub selection_bg: Color,
129    /// Foreground color for selected items
130    pub selection_fg: Color,
131    /// Color for hovered elements
132    pub hover_color: Color,
133    /// Primary accent color for the theme
134    pub accent_color: Color,
135}
136
137/// Available themes
138#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
139pub enum Theme {
140    /// Dark cyberpunk theme with purples and neon colors
141    CyberpunkDark,
142    /// Classic terminal hacker theme with green on black
143    TerminalHacker,
144    /// Modern IDE theme with soft grays and blues
145    ModernIDE,
146    /// High contrast theme for accessibility
147    HighContrast,
148    /// Solarized dark theme with warm orange and yellow accents
149    SolarizedDark,
150    /// Monokai Pro theme with vibrant colors
151    MonokaiPro,
152    /// Nord dark theme with cool blue-gray colors inspired by Arctic
153    NordDark,
154    /// Dracula theme with purple background and pink accents
155    DraculaDark,
156    /// VS Code light theme with light background
157    VSCodeLight,
158}
159
160impl Default for Theme {
161    fn default() -> Self {
162        Self::ModernIDE
163    }
164}
165
166impl Theme {
167    /// Get all available themes
168    pub fn all() -> &'static [Self] {
169        &[
170            Self::CyberpunkDark,
171            Self::TerminalHacker,
172            Self::ModernIDE,
173            Self::HighContrast,
174            Self::SolarizedDark,
175            Self::MonokaiPro,
176            Self::NordDark,
177            Self::DraculaDark,
178            Self::VSCodeLight,
179        ]
180    }
181
182    /// Get internal name for configuration files
183    pub fn name(&self) -> &'static str {
184        match self {
185            Self::CyberpunkDark => "neon_purple",
186            Self::TerminalHacker => "matrix_green",
187            Self::ModernIDE => "vscode_dark",
188            Self::HighContrast => "accessibility",
189            Self::SolarizedDark => "solarized_dark",
190            Self::MonokaiPro => "monokai_pro",
191            Self::NordDark => "nord_dark",
192            Self::DraculaDark => "dracula_dark",
193            Self::VSCodeLight => "vscode_light",
194        }
195    }
196
197    /// Get display name for UI
198    pub fn display_name(&self) -> &'static str {
199        match self {
200            Self::CyberpunkDark => "Neon Purple",
201            Self::TerminalHacker => "Matrix Green",
202            Self::ModernIDE => "VS Code Dark",
203            Self::HighContrast => "High Contrast",
204            Self::SolarizedDark => "Solarized Dark",
205            Self::MonokaiPro => "Monokai Pro",
206            Self::NordDark => "Nord Dark",
207            Self::DraculaDark => "Dracula",
208            Self::VSCodeLight => "VS Code Light",
209        }
210    }
211
212    /// Get detailed theme description
213    pub fn description(&self) -> &'static str {
214        match self {
215            Self::CyberpunkDark => "Neon purple cyberpunk theme",
216            Self::TerminalHacker => "Classic green terminal theme",
217            Self::ModernIDE => "Professional VS Code dark theme",
218            Self::HighContrast => "High contrast accessibility theme",
219            Self::SolarizedDark => "Warm Solarized dark theme",
220            Self::MonokaiPro => "Vibrant Monokai theme",
221            Self::NordDark => "Cool Arctic-inspired theme",
222            Self::DraculaDark => "Purple Dracula theme",
223            Self::VSCodeLight => "Clean VS Code light theme",
224        }
225    }
226
227    /// Get the next theme in the cycle
228    pub fn next(&self) -> Self {
229        match self {
230            Self::CyberpunkDark => Self::TerminalHacker,
231            Self::TerminalHacker => Self::ModernIDE,
232            Self::ModernIDE => Self::HighContrast,
233            Self::HighContrast => Self::SolarizedDark,
234            Self::SolarizedDark => Self::MonokaiPro,
235            Self::MonokaiPro => Self::NordDark,
236            Self::NordDark => Self::DraculaDark,
237            Self::DraculaDark => Self::VSCodeLight,
238            Self::VSCodeLight => Self::CyberpunkDark,
239        }
240    }
241}
242
243impl From<Theme> for ColorScheme {
244    fn from(theme: Theme) -> Self {
245        match theme {
246            Theme::CyberpunkDark => cyberpunk_dark(),
247            Theme::TerminalHacker => terminal_hacker(),
248            Theme::ModernIDE => modern_ide(),
249            Theme::HighContrast => high_contrast(),
250            Theme::SolarizedDark => solarized_dark(),
251            Theme::MonokaiPro => monokai_pro(),
252            Theme::NordDark => nord_dark(),
253            Theme::DraculaDark => dracula_dark(),
254            Theme::VSCodeLight => vscode_light(),
255        }
256    }
257}
258
259impl Default for ColorScheme {
260    fn default() -> Self {
261        Theme::ModernIDE.into()
262    }
263}
264
265/// Cyberpunk dark theme with deep purples, electric blues, and neon greens
266fn cyberpunk_dark() -> ColorScheme {
267    ColorScheme {
268        // Panel states
269        focused_border: Color::Rgb(138, 43, 226), // Blue-violet
270        unfocused_border: Color::Rgb(75, 75, 75), // Dim gray
271        panel_bg: Color::Rgb(20, 20, 30),         // Very dark blue-gray
272
273        // Code highlighting
274        keyword_color: Color::Rgb(255, 20, 147),  // Deep pink
275        string_color: Color::Rgb(0, 255, 127),    // Spring green
276        comment_color: Color::Rgb(108, 108, 108), // Gray
277        number_color: Color::Rgb(255, 165, 0),    // Orange
278        identifier_color: Color::Rgb(135, 206, 250), // Light sky blue
279        operator_color: Color::Rgb(255, 255, 255), // White
280
281        // Line numbers
282        line_number: Color::Rgb(100, 100, 100), // Muted gray
283        line_number_bg: Color::Rgb(20, 20, 30), // Same as panel bg
284
285        // Syntax highlighting (detailed)
286        syntax_keyword_color: Color::Rgb(255, 20, 147), // Deep pink (keywords)
287        syntax_type_color: Color::Rgb(255, 105, 180),   // Hot pink (types)
288        syntax_string_color: Color::Rgb(0, 255, 127),   // Spring green (strings)
289        syntax_number_color: Color::Rgb(255, 165, 0),   // Orange (numbers)
290        syntax_comment_color: Color::Rgb(108, 108, 108), // Gray (comments)
291        syntax_identifier_color: Color::Rgb(135, 206, 250), // Light sky blue (identifiers)
292        syntax_operator_color: Color::Rgb(255, 255, 255), // White (operators)
293        syntax_punctuation_color: Color::Rgb(220, 220, 220), // Light gray (punctuation)
294        syntax_address_color: Color::Rgb(255, 215, 0),  // Gold (addresses)
295        syntax_pragma_color: Color::Rgb(186, 85, 211),  // Medium orchid (pragmas)
296        syntax_opcode_color: Color::Rgb(0, 255, 255),   // Cyan (opcodes)
297
298        // General highlighting
299        highlight_bg: Color::Rgb(60, 40, 100), // Darker slate blue
300        highlight_fg: Color::Rgb(255, 255, 255), // White
301
302        // Help and UI text
303        help_text_color: Color::Rgb(160, 160, 160), // Light gray
304
305        // Debugging states
306        current_line_bg: Color::Rgb(100, 20, 50), // Dark magenta
307        current_line_fg: Color::Rgb(255, 255, 255), // White
308        breakpoint_color: Color::Rgb(255, 69, 0), // Red-orange
309        error_color: Color::Rgb(220, 20, 60),     // Crimson
310        success_color: Color::Rgb(50, 205, 50),   // Lime green
311        warning_color: Color::Rgb(255, 215, 0),   // Gold
312        info_color: Color::Rgb(30, 144, 255),     // Dodger blue
313
314        // Trace visualization
315        call_color: Color::Rgb(0, 255, 255),    // Cyan
316        return_color: Color::Rgb(50, 205, 50),  // Lime green
317        revert_color: Color::Rgb(255, 69, 0),   // Red-orange
318        create_color: Color::Rgb(255, 20, 147), // Deep pink
319
320        // Terminal
321        prompt_color: Color::Rgb(138, 43, 226), // Blue-violet
322        command_color: Color::Rgb(255, 255, 255), // White
323        output_color: Color::Rgb(192, 192, 192), // Silver
324        cursor_color: Color::Rgb(0, 255, 0),    // Lime
325
326        // Interactive elements
327        selection_bg: Color::Rgb(60, 40, 100), // Darker slate blue
328        selection_fg: Color::Rgb(255, 255, 255), // White
329        hover_color: Color::Rgb(147, 112, 219), // Medium purple
330        accent_color: Color::Rgb(0, 255, 255), // Cyan
331    }
332}
333
334/// Terminal hacker theme with classic green on black
335fn terminal_hacker() -> ColorScheme {
336    ColorScheme {
337        // Panel states
338        focused_border: Color::Rgb(0, 255, 0),   // Lime
339        unfocused_border: Color::Rgb(0, 128, 0), // Green
340        panel_bg: Color::Rgb(0, 0, 0),           // Black
341
342        // Code highlighting
343        keyword_color: Color::Rgb(0, 255, 0),        // Lime
344        string_color: Color::Rgb(0, 255, 127),       // Spring green
345        comment_color: Color::Rgb(0, 128, 0),        // Green
346        number_color: Color::Rgb(0, 255, 255),       // Cyan
347        identifier_color: Color::Rgb(255, 255, 255), // White
348        operator_color: Color::Rgb(0, 255, 0),       // Lime
349
350        // Line numbers
351        line_number: Color::Rgb(0, 128, 0),  // Green
352        line_number_bg: Color::Rgb(0, 0, 0), // Black
353
354        // Syntax highlighting (detailed)
355        syntax_keyword_color: Color::Rgb(0, 255, 0), // Lime (keywords)
356        syntax_type_color: Color::Rgb(0, 255, 127),  // Spring green (types)
357        syntax_string_color: Color::Rgb(0, 255, 127), // Spring green (strings)
358        syntax_number_color: Color::Rgb(0, 255, 255), // Cyan (numbers)
359        syntax_comment_color: Color::Rgb(0, 128, 0), // Green (comments)
360        syntax_identifier_color: Color::Rgb(255, 255, 255), // White (identifiers)
361        syntax_operator_color: Color::Rgb(0, 255, 0), // Lime (operators)
362        syntax_punctuation_color: Color::Rgb(0, 192, 0), // Light green (punctuation)
363        syntax_address_color: Color::Rgb(255, 255, 0), // Yellow (addresses)
364        syntax_pragma_color: Color::Rgb(0, 255, 255), // Cyan (pragmas)
365        syntax_opcode_color: Color::Rgb(0, 255, 255), // Cyan (opcodes)
366
367        // General highlighting
368        highlight_bg: Color::Rgb(0, 80, 0),      // Darker green
369        highlight_fg: Color::Rgb(255, 255, 255), // White
370
371        // Help and UI text
372        help_text_color: Color::Rgb(0, 192, 0), // Light green
373
374        // Debugging states
375        current_line_bg: Color::Rgb(0, 100, 50), // Darker green-teal
376        current_line_fg: Color::Rgb(255, 255, 255), // White
377        breakpoint_color: Color::Rgb(255, 0, 0), // Red
378        error_color: Color::Rgb(255, 0, 0),      // Red
379        success_color: Color::Rgb(0, 255, 0),    // Lime
380        warning_color: Color::Rgb(255, 255, 0),  // Yellow
381        info_color: Color::Rgb(0, 255, 255),     // Cyan
382
383        // Trace visualization
384        call_color: Color::Rgb(0, 255, 255),   // Cyan
385        return_color: Color::Rgb(0, 255, 0),   // Lime
386        revert_color: Color::Rgb(255, 0, 0),   // Red
387        create_color: Color::Rgb(255, 255, 0), // Yellow
388
389        // Terminal
390        prompt_color: Color::Rgb(0, 255, 0),      // Lime
391        command_color: Color::Rgb(255, 255, 255), // White
392        output_color: Color::Rgb(0, 255, 0),      // Lime
393        cursor_color: Color::Rgb(0, 255, 0),      // Lime
394
395        // Interactive elements
396        selection_bg: Color::Rgb(0, 80, 0),      // Darker green
397        selection_fg: Color::Rgb(255, 255, 255), // White
398        hover_color: Color::Rgb(0, 192, 0),      // Light green
399        accent_color: Color::Rgb(0, 255, 255),   // Cyan
400    }
401}
402
403/// Modern IDE theme with soft grays and subtle colors
404fn modern_ide() -> ColorScheme {
405    ColorScheme {
406        // Panel states
407        focused_border: Color::Rgb(0, 122, 204), // VS Code blue
408        unfocused_border: Color::Rgb(60, 60, 60), // Dark gray
409        panel_bg: Color::Rgb(30, 30, 30),        // Dark gray
410
411        // Code highlighting
412        keyword_color: Color::Rgb(86, 156, 214), // Light blue
413        string_color: Color::Rgb(206, 145, 120), // Light orange
414        comment_color: Color::Rgb(106, 153, 85), // Green
415        number_color: Color::Rgb(181, 206, 168), // Light green
416        identifier_color: Color::Rgb(220, 220, 170), // Light yellow
417        operator_color: Color::Rgb(212, 212, 212), // Light gray
418
419        // Line numbers
420        line_number: Color::Rgb(128, 128, 128), // Gray
421        line_number_bg: Color::Rgb(30, 30, 30), // Same as panel bg
422
423        // Syntax highlighting (detailed)
424        syntax_keyword_color: Color::Rgb(86, 156, 214), // Light blue (keywords)
425        syntax_type_color: Color::Rgb(78, 201, 176),    // Teal (types)
426        syntax_string_color: Color::Rgb(206, 145, 120), // Light orange (strings)
427        syntax_number_color: Color::Rgb(181, 206, 168), // Light green (numbers)
428        syntax_comment_color: Color::Rgb(106, 153, 85), // Green (comments)
429        syntax_identifier_color: Color::Rgb(220, 220, 170), // Light yellow (identifiers)
430        syntax_operator_color: Color::Rgb(212, 212, 212), // Light gray (operators)
431        syntax_punctuation_color: Color::Rgb(200, 200, 200), // Light gray (punctuation)
432        syntax_address_color: Color::Rgb(255, 204, 102), // Yellow (addresses)
433        syntax_pragma_color: Color::Rgb(197, 134, 192), // Purple (pragmas)
434        syntax_opcode_color: Color::Rgb(86, 156, 214),  // Light blue (opcodes)
435
436        // General highlighting
437        highlight_bg: Color::Rgb(0, 90, 160), // Darker VS Code blue
438        highlight_fg: Color::Rgb(255, 255, 255), // White
439
440        // Help and UI text
441        help_text_color: Color::Rgb(160, 160, 160), // Light gray
442
443        // Debugging states
444        current_line_bg: Color::Rgb(80, 60, 0), // Dark orange
445        current_line_fg: Color::Rgb(255, 255, 255), // White
446        breakpoint_color: Color::Rgb(244, 71, 71), // Red
447        error_color: Color::Rgb(244, 71, 71),   // Red
448        success_color: Color::Rgb(106, 153, 85), // Green
449        warning_color: Color::Rgb(255, 204, 102), // Yellow
450        info_color: Color::Rgb(86, 156, 214),   // Blue
451
452        // Trace visualization
453        call_color: Color::Rgb(78, 201, 176),    // Teal
454        return_color: Color::Rgb(106, 153, 85),  // Green
455        revert_color: Color::Rgb(244, 71, 71),   // Red
456        create_color: Color::Rgb(197, 134, 192), // Purple
457
458        // Terminal
459        prompt_color: Color::Rgb(0, 122, 204), // VS Code blue
460        command_color: Color::Rgb(212, 212, 212), // Light gray
461        output_color: Color::Rgb(204, 204, 204), // Gray
462        cursor_color: Color::Rgb(255, 255, 255), // White
463
464        // Interactive elements
465        selection_bg: Color::Rgb(0, 90, 160), // Darker VS Code blue
466        selection_fg: Color::Rgb(255, 255, 255), // White
467        hover_color: Color::Rgb(60, 60, 60),  // Dark gray
468        accent_color: Color::Rgb(0, 122, 204), // VS Code blue
469    }
470}
471
472/// High contrast theme for accessibility
473fn high_contrast() -> ColorScheme {
474    ColorScheme {
475        // Panel states
476        focused_border: Color::Rgb(255, 255, 255), // White
477        unfocused_border: Color::Rgb(128, 128, 128), // Gray
478        panel_bg: Color::Rgb(0, 0, 0),             // Black
479
480        // Code highlighting
481        keyword_color: Color::Rgb(255, 255, 0),      // Yellow
482        string_color: Color::Rgb(0, 255, 0),         // Green
483        comment_color: Color::Rgb(128, 128, 128),    // Gray
484        number_color: Color::Rgb(0, 255, 255),       // Cyan
485        identifier_color: Color::Rgb(255, 255, 255), // White
486        operator_color: Color::Rgb(255, 255, 255),   // White
487
488        // Line numbers
489        line_number: Color::Rgb(255, 255, 255), // White
490        line_number_bg: Color::Rgb(0, 0, 0),    // Black
491
492        // Syntax highlighting (detailed)
493        syntax_keyword_color: Color::Rgb(255, 255, 0), // Yellow (keywords)
494        syntax_type_color: Color::Rgb(255, 0, 255),    // Magenta (types)
495        syntax_string_color: Color::Rgb(0, 255, 0),    // Green (strings)
496        syntax_number_color: Color::Rgb(0, 255, 255),  // Cyan (numbers)
497        syntax_comment_color: Color::Rgb(128, 128, 128), // Gray (comments)
498        syntax_identifier_color: Color::Rgb(255, 255, 255), // White (identifiers)
499        syntax_operator_color: Color::Rgb(255, 255, 255), // White (operators)
500        syntax_punctuation_color: Color::Rgb(255, 255, 255), // White (punctuation)
501        syntax_address_color: Color::Rgb(255, 255, 0), // Yellow (addresses)
502        syntax_pragma_color: Color::Rgb(255, 0, 255),  // Magenta (pragmas)
503        syntax_opcode_color: Color::Rgb(0, 255, 255),  // Cyan (opcodes)
504
505        // General highlighting
506        highlight_bg: Color::Rgb(200, 200, 200), // Light gray
507        highlight_fg: Color::Rgb(0, 0, 0),       // Black
508
509        // Help and UI text
510        help_text_color: Color::Rgb(255, 255, 255), // White
511
512        // Debugging states
513        current_line_bg: Color::Rgb(180, 180, 180), // Medium gray
514        current_line_fg: Color::Rgb(0, 0, 0),       // Black
515        breakpoint_color: Color::Rgb(255, 0, 0),    // Red
516        error_color: Color::Rgb(255, 0, 0),         // Red
517        success_color: Color::Rgb(0, 255, 0),       // Green
518        warning_color: Color::Rgb(255, 255, 0),     // Yellow
519        info_color: Color::Rgb(0, 0, 255),          // Blue
520
521        // Trace visualization
522        call_color: Color::Rgb(0, 255, 255),   // Cyan
523        return_color: Color::Rgb(0, 255, 0),   // Green
524        revert_color: Color::Rgb(255, 0, 0),   // Red
525        create_color: Color::Rgb(255, 0, 255), // Magenta
526
527        // Terminal
528        prompt_color: Color::Rgb(255, 255, 255),  // White
529        command_color: Color::Rgb(255, 255, 255), // White
530        output_color: Color::Rgb(255, 255, 255),  // White
531        cursor_color: Color::Rgb(255, 255, 255),  // White
532
533        // Interactive elements
534        selection_bg: Color::Rgb(200, 200, 200), // Light gray
535        selection_fg: Color::Rgb(0, 0, 0),       // Black
536        hover_color: Color::Rgb(128, 128, 128),  // Gray
537        accent_color: Color::Rgb(255, 255, 255), // White
538    }
539}
540
541/// Solarized dark theme with warm orange and yellow accents
542fn solarized_dark() -> ColorScheme {
543    ColorScheme {
544        // Panel states
545        focused_border: Color::Rgb(38, 139, 210), // Solarized blue
546        unfocused_border: Color::Rgb(88, 110, 117), // Solarized base01
547        panel_bg: Color::Rgb(0, 43, 54),          // Solarized base03
548
549        // Code highlighting
550        keyword_color: Color::Rgb(133, 153, 0), // Solarized green
551        string_color: Color::Rgb(42, 161, 152), // Solarized cyan
552        comment_color: Color::Rgb(101, 123, 131), // Solarized base00
553        number_color: Color::Rgb(203, 75, 22),  // Solarized orange
554        identifier_color: Color::Rgb(131, 148, 150), // Solarized base0
555        operator_color: Color::Rgb(147, 161, 161), // Solarized base1
556
557        // Line numbers
558        line_number: Color::Rgb(88, 110, 117), // Solarized base01
559        line_number_bg: Color::Rgb(0, 43, 54), // Solarized base03
560
561        // Syntax highlighting (detailed)
562        syntax_keyword_color: Color::Rgb(133, 153, 0), // Green (keywords)
563        syntax_type_color: Color::Rgb(181, 137, 0),    // Yellow (types)
564        syntax_string_color: Color::Rgb(42, 161, 152), // Cyan (strings)
565        syntax_number_color: Color::Rgb(203, 75, 22),  // Orange (numbers)
566        syntax_comment_color: Color::Rgb(101, 123, 131), // Base00 (comments)
567        syntax_identifier_color: Color::Rgb(131, 148, 150), // Base0 (identifiers)
568        syntax_operator_color: Color::Rgb(147, 161, 161), // Base1 (operators)
569        syntax_punctuation_color: Color::Rgb(147, 161, 161), // Base1 (punctuation)
570        syntax_address_color: Color::Rgb(203, 75, 22), // Orange (addresses)
571        syntax_pragma_color: Color::Rgb(108, 113, 196), // Violet (pragmas)
572        syntax_opcode_color: Color::Rgb(38, 139, 210), // Blue (opcodes)
573
574        // General highlighting
575        highlight_bg: Color::Rgb(30, 100, 160), // Darker solarized blue
576        highlight_fg: Color::Rgb(253, 246, 227), // Solarized base3
577
578        // Help and UI text
579        help_text_color: Color::Rgb(131, 148, 150), // Solarized base0
580
581        // Debugging states
582        current_line_bg: Color::Rgb(100, 50, 0), // Dark orange-brown
583        current_line_fg: Color::Rgb(253, 246, 227), // Solarized base3
584        breakpoint_color: Color::Rgb(220, 50, 47), // Solarized red
585        error_color: Color::Rgb(220, 50, 47),    // Solarized red
586        success_color: Color::Rgb(133, 153, 0),  // Solarized green
587        warning_color: Color::Rgb(181, 137, 0),  // Solarized yellow
588        info_color: Color::Rgb(38, 139, 210),    // Solarized blue
589
590        // Trace visualization
591        call_color: Color::Rgb(42, 161, 152),    // Cyan
592        return_color: Color::Rgb(133, 153, 0),   // Green
593        revert_color: Color::Rgb(220, 50, 47),   // Red
594        create_color: Color::Rgb(108, 113, 196), // Violet
595
596        // Terminal
597        prompt_color: Color::Rgb(38, 139, 210),   // Blue
598        command_color: Color::Rgb(147, 161, 161), // Base1
599        output_color: Color::Rgb(131, 148, 150),  // Base0
600        cursor_color: Color::Rgb(220, 50, 47),    // Red
601
602        // Interactive elements
603        selection_bg: Color::Rgb(30, 100, 160), // Darker solarized blue
604        selection_fg: Color::Rgb(253, 246, 227), // Base3
605        hover_color: Color::Rgb(88, 110, 117),  // Base01
606        accent_color: Color::Rgb(203, 75, 22),  // Orange
607    }
608}
609
610/// Monokai Pro theme with vibrant colors
611fn monokai_pro() -> ColorScheme {
612    ColorScheme {
613        // Panel states
614        focused_border: Color::Rgb(102, 217, 239), // Monokai cyan
615        unfocused_border: Color::Rgb(90, 90, 90),  // Dark gray
616        panel_bg: Color::Rgb(45, 42, 46),          // Monokai background
617
618        // Code highlighting
619        keyword_color: Color::Rgb(249, 38, 114), // Monokai pink
620        string_color: Color::Rgb(230, 219, 116), // Monokai yellow
621        comment_color: Color::Rgb(117, 113, 94), // Monokai comment
622        number_color: Color::Rgb(174, 129, 255), // Monokai purple
623        identifier_color: Color::Rgb(248, 248, 242), // Monokai foreground
624        operator_color: Color::Rgb(249, 38, 114), // Monokai pink
625
626        // Line numbers
627        line_number: Color::Rgb(90, 90, 90),    // Gray
628        line_number_bg: Color::Rgb(45, 42, 46), // Monokai background
629
630        // Syntax highlighting (detailed)
631        syntax_keyword_color: Color::Rgb(249, 38, 114), // Pink (keywords)
632        syntax_type_color: Color::Rgb(102, 217, 239),   // Cyan (types)
633        syntax_string_color: Color::Rgb(230, 219, 116), // Yellow (strings)
634        syntax_number_color: Color::Rgb(174, 129, 255), // Purple (numbers)
635        syntax_comment_color: Color::Rgb(117, 113, 94), // Comment gray
636        syntax_identifier_color: Color::Rgb(248, 248, 242), // Foreground
637        syntax_operator_color: Color::Rgb(249, 38, 114), // Pink (operators)
638        syntax_punctuation_color: Color::Rgb(248, 248, 242), // Foreground
639        syntax_address_color: Color::Rgb(230, 219, 116), // Yellow (addresses)
640        syntax_pragma_color: Color::Rgb(174, 129, 255), // Purple (pragmas)
641        syntax_opcode_color: Color::Rgb(166, 226, 46),  // Green (opcodes)
642
643        // General highlighting
644        highlight_bg: Color::Rgb(60, 60, 65), // Even darker gray
645        highlight_fg: Color::Rgb(248, 248, 242), // Foreground
646
647        // Help and UI text
648        help_text_color: Color::Rgb(248, 248, 242), // Foreground
649
650        // Debugging states
651        current_line_bg: Color::Rgb(80, 40, 80), // Dark purple
652        current_line_fg: Color::Rgb(248, 248, 242), // Foreground
653        breakpoint_color: Color::Rgb(249, 38, 114), // Pink
654        error_color: Color::Rgb(249, 38, 114),   // Pink
655        success_color: Color::Rgb(166, 226, 46), // Green
656        warning_color: Color::Rgb(230, 219, 116), // Yellow
657        info_color: Color::Rgb(102, 217, 239),   // Cyan
658
659        // Trace visualization
660        call_color: Color::Rgb(102, 217, 239),   // Cyan
661        return_color: Color::Rgb(166, 226, 46),  // Green
662        revert_color: Color::Rgb(249, 38, 114),  // Pink
663        create_color: Color::Rgb(174, 129, 255), // Purple
664
665        // Terminal
666        prompt_color: Color::Rgb(249, 38, 114),   // Pink
667        command_color: Color::Rgb(248, 248, 242), // Foreground
668        output_color: Color::Rgb(248, 248, 242),  // Foreground
669        cursor_color: Color::Rgb(102, 217, 239),  // Cyan
670
671        // Interactive elements
672        selection_bg: Color::Rgb(60, 60, 65), // Even darker gray
673        selection_fg: Color::Rgb(248, 248, 242), // Foreground
674        hover_color: Color::Rgb(90, 90, 90),  // Gray
675        accent_color: Color::Rgb(249, 38, 114), // Pink
676    }
677}
678
679/// Nord dark theme with cool blue-gray colors
680fn nord_dark() -> ColorScheme {
681    ColorScheme {
682        // Panel states
683        focused_border: Color::Rgb(136, 192, 208), // Nord frost
684        unfocused_border: Color::Rgb(76, 86, 106), // Nord polar night
685        panel_bg: Color::Rgb(46, 52, 64),          // Nord polar night
686
687        // Code highlighting
688        keyword_color: Color::Rgb(129, 161, 193), // Nord frost
689        string_color: Color::Rgb(163, 190, 140),  // Nord aurora green
690        comment_color: Color::Rgb(76, 86, 106),   // Nord polar night
691        number_color: Color::Rgb(180, 142, 173),  // Nord aurora purple
692        identifier_color: Color::Rgb(216, 222, 233), // Nord snow storm
693        operator_color: Color::Rgb(236, 239, 244), // Nord snow storm
694
695        // Line numbers
696        line_number: Color::Rgb(76, 86, 106), // Nord polar night
697        line_number_bg: Color::Rgb(46, 52, 64), // Nord polar night
698
699        // Syntax highlighting (detailed)
700        syntax_keyword_color: Color::Rgb(129, 161, 193), // Frost (keywords)
701        syntax_type_color: Color::Rgb(136, 192, 208),    // Frost (types)
702        syntax_string_color: Color::Rgb(163, 190, 140),  // Aurora green (strings)
703        syntax_number_color: Color::Rgb(180, 142, 173),  // Aurora purple (numbers)
704        syntax_comment_color: Color::Rgb(76, 86, 106),   // Polar night (comments)
705        syntax_identifier_color: Color::Rgb(216, 222, 233), // Snow storm (identifiers)
706        syntax_operator_color: Color::Rgb(236, 239, 244), // Snow storm (operators)
707        syntax_punctuation_color: Color::Rgb(236, 239, 244), // Snow storm (punctuation)
708        syntax_address_color: Color::Rgb(235, 203, 139), // Aurora yellow (addresses)
709        syntax_pragma_color: Color::Rgb(180, 142, 173),  // Aurora purple (pragmas)
710        syntax_opcode_color: Color::Rgb(136, 192, 208),  // Frost (opcodes)
711
712        // General highlighting
713        highlight_bg: Color::Rgb(50, 56, 70), // Even darker polar night
714        highlight_fg: Color::Rgb(236, 239, 244), // Snow storm
715
716        // Help and UI text
717        help_text_color: Color::Rgb(216, 222, 233), // Snow storm
718
719        // Debugging states
720        current_line_bg: Color::Rgb(80, 60, 40), // Dark brown-orange
721        current_line_fg: Color::Rgb(236, 239, 244), // Snow storm
722        breakpoint_color: Color::Rgb(191, 97, 106), // Aurora red
723        error_color: Color::Rgb(191, 97, 106),   // Aurora red
724        success_color: Color::Rgb(163, 190, 140), // Aurora green
725        warning_color: Color::Rgb(235, 203, 139), // Aurora yellow
726        info_color: Color::Rgb(129, 161, 193),   // Frost
727
728        // Trace visualization
729        call_color: Color::Rgb(136, 192, 208),   // Frost
730        return_color: Color::Rgb(163, 190, 140), // Aurora green
731        revert_color: Color::Rgb(191, 97, 106),  // Aurora red
732        create_color: Color::Rgb(180, 142, 173), // Aurora purple
733
734        // Terminal
735        prompt_color: Color::Rgb(129, 161, 193),  // Frost
736        command_color: Color::Rgb(236, 239, 244), // Snow storm
737        output_color: Color::Rgb(216, 222, 233),  // Snow storm
738        cursor_color: Color::Rgb(136, 192, 208),  // Frost
739
740        // Interactive elements
741        selection_bg: Color::Rgb(50, 56, 70), // Even darker polar night
742        selection_fg: Color::Rgb(236, 239, 244), // Snow storm
743        hover_color: Color::Rgb(76, 86, 106), // Polar night
744        accent_color: Color::Rgb(136, 192, 208), // Frost
745    }
746}
747
748/// Dracula theme with purple background and pink accents
749fn dracula_dark() -> ColorScheme {
750    ColorScheme {
751        // Panel states
752        focused_border: Color::Rgb(255, 121, 198), // Dracula pink
753        unfocused_border: Color::Rgb(98, 114, 164), // Dracula comment
754        panel_bg: Color::Rgb(40, 42, 54),          // Dracula background
755
756        // Code highlighting
757        keyword_color: Color::Rgb(255, 121, 198), // Dracula pink
758        string_color: Color::Rgb(241, 250, 140),  // Dracula yellow
759        comment_color: Color::Rgb(98, 114, 164),  // Dracula comment
760        number_color: Color::Rgb(189, 147, 249),  // Dracula purple
761        identifier_color: Color::Rgb(248, 248, 242), // Dracula foreground
762        operator_color: Color::Rgb(255, 184, 108), // Dracula orange
763
764        // Line numbers
765        line_number: Color::Rgb(98, 114, 164), // Dracula comment
766        line_number_bg: Color::Rgb(40, 42, 54), // Dracula background
767
768        // Syntax highlighting (detailed)
769        syntax_keyword_color: Color::Rgb(255, 121, 198), // Pink (keywords)
770        syntax_type_color: Color::Rgb(139, 233, 253),    // Cyan (types)
771        syntax_string_color: Color::Rgb(241, 250, 140),  // Yellow (strings)
772        syntax_number_color: Color::Rgb(189, 147, 249),  // Purple (numbers)
773        syntax_comment_color: Color::Rgb(98, 114, 164),  // Comment (comments)
774        syntax_identifier_color: Color::Rgb(248, 248, 242), // Foreground (identifiers)
775        syntax_operator_color: Color::Rgb(255, 184, 108), // Orange (operators)
776        syntax_punctuation_color: Color::Rgb(248, 248, 242), // Foreground (punctuation)
777        syntax_address_color: Color::Rgb(255, 184, 108), // Orange (addresses)
778        syntax_pragma_color: Color::Rgb(189, 147, 249),  // Purple (pragmas)
779        syntax_opcode_color: Color::Rgb(80, 250, 123),   // Green (opcodes)
780
781        // General highlighting
782        highlight_bg: Color::Rgb(55, 58, 75), // Darker dracula selection
783        highlight_fg: Color::Rgb(248, 248, 242), // Dracula foreground
784
785        // Help and UI text
786        help_text_color: Color::Rgb(248, 248, 242), // Dracula foreground
787
788        // Debugging states
789        current_line_bg: Color::Rgb(80, 40, 60), // Dark purple-red
790        current_line_fg: Color::Rgb(248, 248, 242), // Dracula foreground
791        breakpoint_color: Color::Rgb(255, 85, 85), // Dracula red
792        error_color: Color::Rgb(255, 85, 85),    // Dracula red
793        success_color: Color::Rgb(80, 250, 123), // Dracula green
794        warning_color: Color::Rgb(241, 250, 140), // Dracula yellow
795        info_color: Color::Rgb(139, 233, 253),   // Dracula cyan
796
797        // Trace visualization
798        call_color: Color::Rgb(139, 233, 253),   // Cyan
799        return_color: Color::Rgb(80, 250, 123),  // Green
800        revert_color: Color::Rgb(255, 85, 85),   // Red
801        create_color: Color::Rgb(189, 147, 249), // Purple
802
803        // Terminal
804        prompt_color: Color::Rgb(255, 121, 198),  // Pink
805        command_color: Color::Rgb(248, 248, 242), // Foreground
806        output_color: Color::Rgb(248, 248, 242),  // Foreground
807        cursor_color: Color::Rgb(255, 121, 198),  // Pink
808
809        // Interactive elements
810        selection_bg: Color::Rgb(55, 58, 75), // Darker selection
811        selection_fg: Color::Rgb(248, 248, 242), // Foreground
812        hover_color: Color::Rgb(98, 114, 164), // Comment
813        accent_color: Color::Rgb(255, 121, 198), // Pink
814    }
815}
816
817/// VS Code light theme with light background
818fn vscode_light() -> ColorScheme {
819    ColorScheme {
820        // Panel states
821        focused_border: Color::Rgb(0, 122, 204), // VS Code blue
822        unfocused_border: Color::Rgb(200, 200, 200), // Light gray
823        panel_bg: Color::Rgb(255, 255, 255),     // White
824
825        // Code highlighting
826        keyword_color: Color::Rgb(0, 0, 255),  // Blue
827        string_color: Color::Rgb(163, 21, 21), // Dark red
828        comment_color: Color::Rgb(0, 128, 0),  // Green
829        number_color: Color::Rgb(9, 134, 88),  // Dark green
830        identifier_color: Color::Rgb(0, 0, 0), // Black
831        operator_color: Color::Rgb(0, 0, 0),   // Black
832
833        // Line numbers
834        line_number: Color::Rgb(128, 128, 128),    // Gray
835        line_number_bg: Color::Rgb(255, 255, 255), // White
836
837        // Syntax highlighting (detailed)
838        syntax_keyword_color: Color::Rgb(0, 0, 255), // Blue (keywords)
839        syntax_type_color: Color::Rgb(43, 145, 175), // Teal (types)
840        syntax_string_color: Color::Rgb(163, 21, 21), // Dark red (strings)
841        syntax_number_color: Color::Rgb(9, 134, 88), // Dark green (numbers)
842        syntax_comment_color: Color::Rgb(0, 128, 0), // Green (comments)
843        syntax_identifier_color: Color::Rgb(0, 0, 0), // Black (identifiers)
844        syntax_operator_color: Color::Rgb(0, 0, 0),  // Black (operators)
845        syntax_punctuation_color: Color::Rgb(0, 0, 0), // Black (punctuation)
846        syntax_address_color: Color::Rgb(121, 94, 38), // Brown (addresses)
847        syntax_pragma_color: Color::Rgb(175, 0, 219), // Purple (pragmas)
848        syntax_opcode_color: Color::Rgb(0, 0, 255),  // Blue (opcodes)
849
850        // General highlighting
851        highlight_bg: Color::Rgb(200, 220, 255), // Very light blue
852        highlight_fg: Color::Rgb(0, 0, 0),       // Black
853
854        // Help and UI text
855        help_text_color: Color::Rgb(106, 106, 106), // Dark gray
856
857        // Debugging states
858        current_line_bg: Color::Rgb(255, 200, 100), // Light orange
859        current_line_fg: Color::Rgb(0, 0, 0),       // Black
860        breakpoint_color: Color::Rgb(205, 49, 49),  // Dark red
861        error_color: Color::Rgb(205, 49, 49),       // Dark red
862        success_color: Color::Rgb(0, 128, 0),       // Green
863        warning_color: Color::Rgb(255, 140, 0),     // Dark orange
864        info_color: Color::Rgb(0, 122, 204),        // Blue
865
866        // Trace visualization
867        call_color: Color::Rgb(43, 145, 175),  // Teal
868        return_color: Color::Rgb(0, 128, 0),   // Green
869        revert_color: Color::Rgb(205, 49, 49), // Dark red
870        create_color: Color::Rgb(175, 0, 219), // Purple
871
872        // Terminal
873        prompt_color: Color::Rgb(0, 122, 204), // Blue
874        command_color: Color::Rgb(0, 0, 0),    // Black
875        output_color: Color::Rgb(0, 0, 0),     // Black
876        cursor_color: Color::Rgb(0, 0, 0),     // Black
877
878        // Interactive elements
879        selection_bg: Color::Rgb(200, 220, 255), // Very light blue
880        selection_fg: Color::Rgb(0, 0, 0),       // Black
881        hover_color: Color::Rgb(229, 229, 229),  // Very light gray
882        accent_color: Color::Rgb(0, 122, 204),   // Blue
883    }
884}
885
886#[cfg(test)]
887mod tests {
888    use super::*;
889
890    #[test]
891    fn test_theme_cycle() {
892        assert_eq!(Theme::CyberpunkDark.next(), Theme::TerminalHacker);
893        assert_eq!(Theme::TerminalHacker.next(), Theme::ModernIDE);
894        assert_eq!(Theme::ModernIDE.next(), Theme::HighContrast);
895        assert_eq!(Theme::HighContrast.next(), Theme::SolarizedDark);
896        assert_eq!(Theme::SolarizedDark.next(), Theme::MonokaiPro);
897        assert_eq!(Theme::MonokaiPro.next(), Theme::NordDark);
898        assert_eq!(Theme::NordDark.next(), Theme::DraculaDark);
899        assert_eq!(Theme::DraculaDark.next(), Theme::VSCodeLight);
900        assert_eq!(Theme::VSCodeLight.next(), Theme::CyberpunkDark);
901    }
902
903    #[test]
904    fn test_theme_names() {
905        assert_eq!(Theme::CyberpunkDark.name(), "neon_purple");
906        assert_eq!(Theme::TerminalHacker.name(), "matrix_green");
907        assert_eq!(Theme::ModernIDE.name(), "vscode_dark");
908        assert_eq!(Theme::HighContrast.name(), "accessibility");
909        assert_eq!(Theme::SolarizedDark.name(), "solarized_dark");
910        assert_eq!(Theme::MonokaiPro.name(), "monokai_pro");
911        assert_eq!(Theme::NordDark.name(), "nord_dark");
912        assert_eq!(Theme::DraculaDark.name(), "dracula_dark");
913        assert_eq!(Theme::VSCodeLight.name(), "vscode_light");
914    }
915
916    #[test]
917    fn test_theme_display_names() {
918        assert_eq!(Theme::CyberpunkDark.display_name(), "Neon Purple");
919        assert_eq!(Theme::TerminalHacker.display_name(), "Matrix Green");
920        assert_eq!(Theme::ModernIDE.display_name(), "VS Code Dark");
921        assert_eq!(Theme::HighContrast.display_name(), "High Contrast");
922        assert_eq!(Theme::SolarizedDark.display_name(), "Solarized Dark");
923        assert_eq!(Theme::MonokaiPro.display_name(), "Monokai Pro");
924        assert_eq!(Theme::NordDark.display_name(), "Nord Dark");
925        assert_eq!(Theme::DraculaDark.display_name(), "Dracula");
926        assert_eq!(Theme::VSCodeLight.display_name(), "VS Code Light");
927    }
928
929    #[test]
930    fn test_color_scheme_conversion() {
931        let scheme: ColorScheme = Theme::CyberpunkDark.into();
932        // Just verify it doesn't panic and has reasonable values
933        assert_ne!(scheme.focused_border, scheme.unfocused_border);
934    }
935}