boxmux 0.240.3373

YAML-driven terminal UI framework for rich, interactive CLI applications and dashboards with PTY support
Documentation
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
use crate::draw_utils::print_with_color_and_background_at;
use crate::model::choice::Choice;
use crate::model::common::{Bounds, ScreenBuffer};

/// Selection highlighting styles for choice menus
#[derive(Debug, Clone, PartialEq)]
pub enum SelectionStyle {
    /// Standard color-based highlighting (current default behavior)
    ColorHighlight,
    /// Inverted colors for selection
    InvertColors,
    /// Border/frame around selected item
    BorderHighlight,
    /// Arrow or pointer indicator
    PointerIndicator,
    /// Underline the selected text
    UnderlineHighlight,
    /// Bold text for selected item
    BoldHighlight,
    /// Combination of multiple styles
    Combined(Vec<SelectionStyle>),
}

/// Focus indication styles for keyboard navigation
#[derive(Debug, Clone, PartialEq)]
pub enum FocusStyle {
    /// No special focus indication beyond selection
    None,
    /// Blinking or animated focus indicator
    Blinking,
    /// Extra bright/intense colors when focused
    Intensity,
    /// Dotted border around focused area
    DottedBorder,
    /// Animated arrow or cursor
    AnimatedCursor,
}

/// Visual feedback styles for user interactions
#[derive(Debug, Clone, PartialEq)]
pub enum FeedbackStyle {
    /// Brief color flash on selection change
    ColorFlash,
    /// Smooth color transition animation
    ColorTransition,
    /// Visual ripple effect from interaction point
    RippleEffect,
    /// Slide/movement animation
    SlideAnimation,
    /// No visual feedback
    None,
}

/// Configuration for choice selection styling
#[derive(Debug, Clone)]
pub struct SelectionStyleConfig {
    pub selection_style: SelectionStyle,
    pub focus_style: FocusStyle,
    pub feedback_style: FeedbackStyle,
    pub animation_duration_ms: u32,
    pub intensity_factor: f32,
    pub custom_indicators: Option<SelectionIndicators>,
}

/// Custom selection indicators and symbols
#[derive(Debug, Clone)]
pub struct SelectionIndicators {
    pub pointer_symbol: String,
    pub selection_prefix: String,
    pub selection_suffix: String,
    pub focus_indicator: String,
    pub border_chars: BorderChars,
}

/// Custom border characters for selection highlighting
#[derive(Debug, Clone)]
pub struct BorderChars {
    pub top_left: char,
    pub top_right: char,
    pub bottom_left: char,
    pub bottom_right: char,
    pub horizontal: char,
    pub vertical: char,
}

impl Default for SelectionStyleConfig {
    fn default() -> Self {
        Self {
            selection_style: SelectionStyle::ColorHighlight,
            focus_style: FocusStyle::None,
            feedback_style: FeedbackStyle::None,
            animation_duration_ms: 200,
            intensity_factor: 1.5,
            custom_indicators: None,
        }
    }
}

impl Default for SelectionIndicators {
    fn default() -> Self {
        Self {
            pointer_symbol: "".to_string(),
            selection_prefix: "".to_string(),
            selection_suffix: "".to_string(),
            focus_indicator: "".to_string(),
            border_chars: BorderChars::default(),
        }
    }
}

impl Default for BorderChars {
    fn default() -> Self {
        Self {
            top_left: '',
            top_right: '',
            bottom_left: '',
            bottom_right: '',
            horizontal: '',
            vertical: '',
        }
    }
}

/// Enhanced selection styling component
pub struct SelectionStyleRenderer {
    pub id: String,
    pub config: SelectionStyleConfig,
}

impl SelectionStyleRenderer {
    /// Create new selection style renderer with configuration
    pub fn new(id: String, config: SelectionStyleConfig) -> Self {
        Self { id, config }
    }

    /// Create with default configuration
    pub fn with_defaults(id: String) -> Self {
        Self {
            id,
            config: SelectionStyleConfig::default(),
        }
    }

    /// Render choice with enhanced selection styling
    pub fn render_choice(
        &self,
        choice: &Choice,
        bounds: &Bounds,
        y_position: usize,
        x_position: usize,
        base_fg_color: &Option<String>,
        base_bg_color: &Option<String>,
        selected_fg_color: &Option<String>,
        selected_bg_color: &Option<String>,
        is_focused: bool,
        buffer: &mut ScreenBuffer,
    ) {
        let (final_fg_color, final_bg_color, display_text) = self.calculate_style_colors_and_text(
            choice,
            base_fg_color,
            base_bg_color,
            selected_fg_color,
            selected_bg_color,
            is_focused,
        );

        // Render the main choice content
        print_with_color_and_background_at(
            y_position,
            x_position,
            &final_fg_color,
            &final_bg_color,
            &display_text,
            buffer,
        );

        // Apply additional styling based on selection style
        if choice.selected {
            self.apply_selection_style(
                choice,
                bounds,
                y_position,
                x_position,
                &display_text,
                buffer,
            );
        }

        // Apply focus indicators if focused
        if is_focused {
            self.apply_focus_style(bounds, y_position, x_position, &display_text, buffer);
        }
    }

    /// Calculate final colors and text based on style configuration
    pub fn calculate_style_colors_and_text(
        &self,
        choice: &Choice,
        base_fg_color: &Option<String>,
        base_bg_color: &Option<String>,
        selected_fg_color: &Option<String>,
        selected_bg_color: &Option<String>,
        is_focused: bool,
    ) -> (Option<String>, Option<String>, String) {
        let mut fg_color = if choice.selected {
            selected_fg_color.clone()
        } else {
            base_fg_color.clone()
        };

        let mut bg_color = if choice.selected {
            selected_bg_color.clone()
        } else {
            base_bg_color.clone()
        };

        let mut display_text = choice.content.as_ref().unwrap_or(&String::new()).clone();

        // Apply selection style modifications
        if choice.selected {
            match &self.config.selection_style {
                SelectionStyle::InvertColors => {
                    // Swap foreground and background colors
                    std::mem::swap(&mut fg_color, &mut bg_color);
                }
                SelectionStyle::BoldHighlight => {
                    // Use bright color variants for bold effect
                    fg_color = self.make_color_bright(&fg_color);
                }
                SelectionStyle::PointerIndicator => {
                    // Add pointer symbol prefix
                    let default_indicators = SelectionIndicators::default();
                    let indicators = self
                        .config
                        .custom_indicators
                        .as_ref()
                        .unwrap_or(&default_indicators);
                    display_text = format!("{} {}", indicators.pointer_symbol, display_text);
                }
                SelectionStyle::Combined(styles) => {
                    // Apply multiple styles
                    for style in styles {
                        match style {
                            SelectionStyle::InvertColors => {
                                std::mem::swap(&mut fg_color, &mut bg_color);
                            }
                            SelectionStyle::BoldHighlight => {
                                fg_color = self.make_color_bright(&fg_color);
                            }
                            SelectionStyle::PointerIndicator => {
                                let default_indicators = SelectionIndicators::default();
                                let indicators = self
                                    .config
                                    .custom_indicators
                                    .as_ref()
                                    .unwrap_or(&default_indicators);
                                display_text =
                                    format!("{} {}", indicators.pointer_symbol, display_text);
                            }
                            _ => {} // Other styles handled separately
                        }
                    }
                }
                _ => {} // ColorHighlight and other styles use base colors
            }
        }

        // Apply focus intensity if focused
        if is_focused && matches!(self.config.focus_style, FocusStyle::Intensity) {
            fg_color = self.apply_intensity(&fg_color);
        }

        // Add waiting state indicator if needed
        if choice.waiting {
            display_text = format!("{}...", display_text);
        }

        (fg_color, bg_color, display_text)
    }

    /// Apply additional selection styling (borders, underlines, etc.)
    fn apply_selection_style(
        &self,
        _choice: &Choice,
        bounds: &Bounds,
        y_position: usize,
        x_position: usize,
        display_text: &str,
        buffer: &mut ScreenBuffer,
    ) {
        match &self.config.selection_style {
            SelectionStyle::BorderHighlight => {
                self.draw_selection_border(
                    bounds,
                    y_position,
                    x_position,
                    display_text.len(),
                    buffer,
                );
            }
            SelectionStyle::UnderlineHighlight => {
                self.draw_selection_underline(
                    bounds,
                    y_position,
                    x_position,
                    display_text.len(),
                    buffer,
                );
            }
            SelectionStyle::Combined(styles) => {
                if styles.contains(&SelectionStyle::BorderHighlight) {
                    self.draw_selection_border(
                        bounds,
                        y_position,
                        x_position,
                        display_text.len(),
                        buffer,
                    );
                }
                if styles.contains(&SelectionStyle::UnderlineHighlight) {
                    self.draw_selection_underline(
                        bounds,
                        y_position,
                        x_position,
                        display_text.len(),
                        buffer,
                    );
                }
            }
            _ => {}
        }
    }

    /// Apply focus styling indicators
    fn apply_focus_style(
        &self,
        bounds: &Bounds,
        y_position: usize,
        x_position: usize,
        display_text: &str,
        buffer: &mut ScreenBuffer,
    ) {
        match &self.config.focus_style {
            FocusStyle::DottedBorder => {
                self.draw_dotted_focus_border(
                    bounds,
                    y_position,
                    x_position,
                    display_text.len(),
                    buffer,
                );
            }
            FocusStyle::AnimatedCursor => {
                self.draw_animated_cursor(bounds, y_position, x_position, buffer);
            }
            FocusStyle::Blinking => {
                // Blinking effect would need frame timing - simplified here
                self.draw_focus_indicator(bounds, y_position, x_position, buffer);
            }
            _ => {}
        }
    }

    /// Draw border around selected choice
    fn draw_selection_border(
        &self,
        bounds: &Bounds,
        y_position: usize,
        x_position: usize,
        text_length: usize,
        buffer: &mut ScreenBuffer,
    ) {
        let default_indicators = SelectionIndicators::default();
        let indicators = self
            .config
            .custom_indicators
            .as_ref()
            .unwrap_or(&default_indicators);
        let border = &indicators.border_chars;

        // Only draw border if we have space and are within bounds
        if y_position > bounds.top() && y_position < bounds.bottom() && x_position > bounds.left() {
            // Draw corners and sides
            if x_position > 0 {
                print_with_color_and_background_at(
                    y_position,
                    x_position - 1,
                    &Some("bright_yellow".to_string()),
                    &Some("black".to_string()),
                    &border.vertical.to_string(),
                    buffer,
                );
            }

            if x_position + text_length < bounds.right() {
                print_with_color_and_background_at(
                    y_position,
                    x_position + text_length,
                    &Some("bright_yellow".to_string()),
                    &Some("black".to_string()),
                    &border.vertical.to_string(),
                    buffer,
                );
            }
        }
    }

    /// Draw underline under selected choice
    fn draw_selection_underline(
        &self,
        bounds: &Bounds,
        y_position: usize,
        x_position: usize,
        text_length: usize,
        buffer: &mut ScreenBuffer,
    ) {
        if y_position < bounds.bottom() {
            let underline = "".repeat(text_length);
            print_with_color_and_background_at(
                y_position + 1,
                x_position,
                &Some("bright_yellow".to_string()),
                &Some("black".to_string()),
                &underline,
                buffer,
            );
        }
    }

    /// Draw dotted border for focus indication
    fn draw_dotted_focus_border(
        &self,
        bounds: &Bounds,
        y_position: usize,
        x_position: usize,
        text_length: usize,
        buffer: &mut ScreenBuffer,
    ) {
        if y_position >= bounds.top()
            && y_position <= bounds.bottom()
            && x_position >= bounds.left()
        {
            // Draw dotted indicators
            if x_position > 0 {
                print_with_color_and_background_at(
                    y_position,
                    x_position - 1,
                    &Some("bright_cyan".to_string()),
                    &Some("black".to_string()),
                    ":",
                    buffer,
                );
            }

            if x_position + text_length < bounds.right() {
                print_with_color_and_background_at(
                    y_position,
                    x_position + text_length,
                    &Some("bright_cyan".to_string()),
                    &Some("black".to_string()),
                    ":",
                    buffer,
                );
            }
        }
    }

    /// Draw animated cursor for focus
    fn draw_animated_cursor(
        &self,
        bounds: &Bounds,
        y_position: usize,
        x_position: usize,
        buffer: &mut ScreenBuffer,
    ) {
        if y_position >= bounds.top() && y_position <= bounds.bottom() && x_position > bounds.left()
        {
            let default_indicators = SelectionIndicators::default();
            let indicators = self
                .config
                .custom_indicators
                .as_ref()
                .unwrap_or(&default_indicators);
            print_with_color_and_background_at(
                y_position,
                x_position - 1,
                &Some("bright_magenta".to_string()),
                &Some("black".to_string()),
                &indicators.focus_indicator,
                buffer,
            );
        }
    }

    /// Draw simple focus indicator
    fn draw_focus_indicator(
        &self,
        bounds: &Bounds,
        y_position: usize,
        x_position: usize,
        buffer: &mut ScreenBuffer,
    ) {
        if y_position >= bounds.top() && y_position <= bounds.bottom() && x_position > bounds.left()
        {
            print_with_color_and_background_at(
                y_position,
                x_position - 1,
                &Some("bright_white".to_string()),
                &Some("black".to_string()),
                "",
                buffer,
            );
        }
    }

    /// Make color brighter/more intense
    fn make_color_bright(&self, color: &Option<String>) -> Option<String> {
        match color {
            Some(color_str) => match color_str.as_str() {
                "red" => Some("bright_red".to_string()),
                "green" => Some("bright_green".to_string()),
                "blue" => Some("bright_blue".to_string()),
                "yellow" => Some("bright_yellow".to_string()),
                "magenta" => Some("bright_magenta".to_string()),
                "cyan" => Some("bright_cyan".to_string()),
                "white" => Some("bright_white".to_string()),
                "black" => Some("bright_black".to_string()),
                _ => Some(color_str.clone()), // Return as-is if already bright or unknown
            },
            None => None, // Transparent remains transparent
        }
    }

    /// Apply intensity factor to color
    fn apply_intensity(&self, color: &Option<String>) -> Option<String> {
        // For now, just make it bright - could be enhanced with RGB manipulation
        self.make_color_bright(color)
    }

    /// Get default selection style for migration from existing choice renderer
    pub fn get_legacy_style_config() -> SelectionStyleConfig {
        SelectionStyleConfig {
            selection_style: SelectionStyle::ColorHighlight,
            focus_style: FocusStyle::None,
            feedback_style: FeedbackStyle::None,
            animation_duration_ms: 0,
            intensity_factor: 1.0,
            custom_indicators: None,
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::model::common::ScreenBuffer;

    #[test]
    fn test_selection_style_renderer_creation() {
        let renderer = SelectionStyleRenderer::with_defaults("test".to_string());
        assert_eq!(renderer.id, "test");
        assert_eq!(
            renderer.config.selection_style,
            SelectionStyle::ColorHighlight
        );
    }

    #[test]
    fn test_custom_selection_style_config() {
        let config = SelectionStyleConfig {
            selection_style: SelectionStyle::PointerIndicator,
            focus_style: FocusStyle::Intensity,
            feedback_style: FeedbackStyle::ColorFlash,
            animation_duration_ms: 300,
            intensity_factor: 2.0,
            custom_indicators: Some(SelectionIndicators::default()),
        };

        let renderer = SelectionStyleRenderer::new("custom".to_string(), config);
        assert!(matches!(
            renderer.config.selection_style,
            SelectionStyle::PointerIndicator
        ));
        assert!(matches!(renderer.config.focus_style, FocusStyle::Intensity));
    }

    #[test]
    fn test_color_bright_conversion() {
        let renderer = SelectionStyleRenderer::with_defaults("test".to_string());
        assert_eq!(
            renderer.make_color_bright(&Some("red".to_string())),
            Some("bright_red".to_string())
        );
        assert_eq!(
            renderer.make_color_bright(&Some("green".to_string())),
            Some("bright_green".to_string())
        );
        assert_eq!(
            renderer.make_color_bright(&Some("bright_blue".to_string())),
            Some("bright_blue".to_string())
        ); // Already bright
        assert_eq!(renderer.make_color_bright(&None), None); // Transparent stays transparent
    }

    #[test]
    fn test_selection_indicators_default() {
        let indicators = SelectionIndicators::default();
        assert_eq!(indicators.pointer_symbol, "");
        assert_eq!(indicators.focus_indicator, "");
        assert_eq!(indicators.border_chars.top_left, '');
    }

    #[test]
    fn test_combined_selection_styles() {
        let combined = SelectionStyle::Combined(vec![
            SelectionStyle::PointerIndicator,
            SelectionStyle::BoldHighlight,
            SelectionStyle::BorderHighlight,
        ]);

        if let SelectionStyle::Combined(styles) = combined {
            assert_eq!(styles.len(), 3);
            assert!(styles.contains(&SelectionStyle::PointerIndicator));
            assert!(styles.contains(&SelectionStyle::BoldHighlight));
            assert!(styles.contains(&SelectionStyle::BorderHighlight));
        } else {
            panic!("Expected Combined selection style");
        }
    }

    #[test]
    fn test_calculate_style_colors_and_text_basic() {
        let renderer = SelectionStyleRenderer::with_defaults("test".to_string());
        let mut choice = Choice {
            id: "test_choice".to_string(),
            content: Some("Test Choice".to_string()),
            selected: true,
            hovered: false,
            waiting: false,
            script: None,
            execution_mode: crate::model::common::ExecutionMode::Immediate,
            redirect_output: None,
            append_output: None,
        };

        let (fg, bg, text) = renderer.calculate_style_colors_and_text(
            &choice,
            &Some("white".to_string()),
            &Some("black".to_string()),
            &Some("bright_white".to_string()),
            &Some("blue".to_string()),
            false,
        );

        assert_eq!(fg, Some("bright_white".to_string()));
        assert_eq!(bg, Some("blue".to_string()));
        assert_eq!(text, "Test Choice");
    }

    #[test]
    fn test_calculate_style_colors_and_text_with_pointer() {
        let config = SelectionStyleConfig {
            selection_style: SelectionStyle::PointerIndicator,
            focus_style: FocusStyle::None,
            feedback_style: FeedbackStyle::None,
            animation_duration_ms: 0,
            intensity_factor: 1.0,
            custom_indicators: Some(SelectionIndicators::default()),
        };

        let renderer = SelectionStyleRenderer::new("test".to_string(), config);
        let choice = Choice {
            id: "menu_item".to_string(),
            content: Some("Menu Item".to_string()),
            selected: true,
            hovered: false,
            waiting: false,
            script: None,
            execution_mode: crate::model::common::ExecutionMode::Immediate,
            redirect_output: None,
            append_output: None,
        };

        let (fg, bg, text) = renderer.calculate_style_colors_and_text(
            &choice,
            &Some("white".to_string()),
            &Some("black".to_string()),
            &Some("bright_white".to_string()),
            &Some("blue".to_string()),
            false,
        );

        assert_eq!(fg, Some("bright_white".to_string()));
        assert_eq!(bg, Some("blue".to_string()));
        assert_eq!(text, "▶ Menu Item");
    }

    #[test]
    fn test_inverted_colors() {
        let config = SelectionStyleConfig {
            selection_style: SelectionStyle::InvertColors,
            ..SelectionStyleConfig::default()
        };

        let renderer = SelectionStyleRenderer::new("test".to_string(), config);
        let choice = Choice {
            id: "inverted".to_string(),
            content: Some("Inverted".to_string()),
            selected: true,
            hovered: false,
            waiting: false,
            script: None,
            execution_mode: crate::model::common::ExecutionMode::Immediate,
            redirect_output: None,
            append_output: None,
        };

        let (fg, bg, text) = renderer.calculate_style_colors_and_text(
            &choice,
            &Some("white".to_string()),
            &Some("black".to_string()),
            &Some("bright_white".to_string()),
            &Some("blue".to_string()),
            false,
        );

        // Colors should be swapped
        assert_eq!(fg, Some("blue".to_string()));
        assert_eq!(bg, Some("bright_white".to_string()));
        assert_eq!(text, "Inverted");
    }

    #[test]
    fn test_waiting_state_indicator() {
        let renderer = SelectionStyleRenderer::with_defaults("test".to_string());
        let choice = Choice {
            id: "loading".to_string(),
            content: Some("Loading".to_string()),
            selected: false,
            hovered: false,
            waiting: true,
            script: None,
            execution_mode: crate::model::common::ExecutionMode::Immediate,
            redirect_output: None,
            append_output: None,
        };

        let (fg, bg, text) = renderer.calculate_style_colors_and_text(
            &choice,
            &Some("white".to_string()),
            &Some("black".to_string()),
            &Some("bright_white".to_string()),
            &Some("blue".to_string()),
            false,
        );

        assert_eq!(text, "Loading...");
    }

    #[test]
    fn test_focus_intensity() {
        let config = SelectionStyleConfig {
            selection_style: SelectionStyle::ColorHighlight,
            focus_style: FocusStyle::Intensity,
            ..SelectionStyleConfig::default()
        };

        let renderer = SelectionStyleRenderer::new("test".to_string(), config);
        let choice = Choice {
            id: "focused".to_string(),
            content: Some("Focused".to_string()),
            selected: true,
            hovered: false,
            waiting: false,
            script: None,
            execution_mode: crate::model::common::ExecutionMode::Immediate,
            redirect_output: None,
            append_output: None,
        };

        let (fg, bg, text) = renderer.calculate_style_colors_and_text(
            &choice,
            &Some("white".to_string()),
            &Some("black".to_string()),
            &Some("red".to_string()),
            &Some("blue".to_string()),
            true, // is_focused = true
        );

        // Should apply intensity to red -> bright_red
        assert_eq!(fg, Some("bright_red".to_string()));
        assert_eq!(bg, Some("blue".to_string()));
    }
}