runa-tui 0.5.2

A fast, keyboard-focused terminal file browser (TUI). Highly configurable and lightweight. Previously known as runner-tui.
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
//! Theme configuration options for runa
//!
//! This module defines the theme configuration options which are read from the runa.toml
//! configuration file.
//!
//! Also holds the internal themes and the logic to apply user overrides on top of them.

use crate::config::presets::*;
use crate::ui::widgets::{DialogPosition, DialogSize};
use crate::utils::parse_color;

use once_cell::sync::Lazy;
use ratatui::style::{Color, Style};
use serde::Deserialize;

/// Theme configuration options
/// Holds all color and style options for the application.
/// Also holds the internal themes and the logic to apply user overrides on top of them.
/// # Examples
/// ```toml
/// [theme]
/// name = "gruvbox-dark"
/// [theme.entry]
/// fg = "white"
/// bg = "black"
/// [theme.selection]
/// bg = "grey"
/// ```
#[derive(Deserialize, Debug)]
#[serde(default)]
pub struct Theme {
    name: Option<String>,
    selection: ColorPair,
    underline: ColorPair,
    accent: ColorPair,
    entry: ColorPair,
    directory: ColorPair,
    separator: ColorPair,
    selection_icon: String,
    parent: PaneTheme,
    preview: PaneTheme,
    path: ColorPair,
    status_line: ColorPair,
    #[serde(deserialize_with = "deserialize_color_field")]
    symlink: Color,
    marker: MarkerTheme,
    widget: WidgetTheme,
    /// info does not honor the .size field from widget.
    /// info gets auto-sized based on attributes enabled.
    info: WidgetTheme,
}

impl Default for Theme {
    fn default() -> Self {
        Theme {
            name: None,
            accent: ColorPair {
                fg: Color::Indexed(238),
                ..ColorPair::default()
            },
            selection: ColorPair {
                bg: Color::Indexed(236),
                ..ColorPair::default()
            },
            underline: ColorPair::default(),
            entry: ColorPair::default(),
            directory: ColorPair {
                fg: Color::Blue,
                ..ColorPair::default()
            },
            separator: ColorPair {
                fg: Color::Indexed(238),
                ..ColorPair::default()
            },
            selection_icon: "".into(),
            parent: PaneTheme::default(),
            preview: PaneTheme::default(),
            path: ColorPair {
                fg: Color::Magenta,
                ..ColorPair::default()
            },
            status_line: ColorPair::default(),
            symlink: Color::Magenta,
            marker: MarkerTheme::default(),
            widget: WidgetTheme::default(),
            info: WidgetTheme {
                title: ColorPair {
                    fg: Color::Magenta,
                    ..ColorPair::default()
                },
                ..WidgetTheme::default()
            },
        }
    }
}

/// Macro to override a field in the target theme if it differs from the default theme.
/// This is used to apply user-defined overrides on top of a preset theme.
macro_rules! override_if_changed {
    ($target:ident, $user:ident, $default:ident, $field:ident) => {
        if $user.$field != $default.$field {
            $target.$field = $user.$field.clone();
        }
    };
}

/// Theme implementation
/// Provides methods to access theme properties and apply user overrides.
impl Theme {
    /// Get internal default theme reference
    /// Used for fallback when a color is set to Reset
    /// This avoids recreating the default theme multiple times
    /// by using a static Lazy instance.
    pub fn internal_defaults() -> &'static Self {
        static DEFAULT: Lazy<Theme> = Lazy::new(Theme::default);
        &DEFAULT
    }

    // Getters for various theme properties with fallbacks to internal defaults
    // _style methods for getting Style instances with fallbacks to internal defaults

    pub fn accent_style(&self) -> Style {
        self.accent.style_or(&Theme::internal_defaults().accent)
    }

    pub fn selection_style(&self) -> Style {
        self.selection
            .style_or(&Theme::internal_defaults().selection)
    }

    pub fn underline_style(&self) -> Style {
        self.underline
            .style_or(&Theme::internal_defaults().underline)
    }

    pub fn entry_style(&self) -> Style {
        self.entry.style_or(&Theme::internal_defaults().entry)
    }

    pub fn directory_style(&self) -> Style {
        self.directory
            .style_or(&Theme::internal_defaults().directory)
    }

    pub fn separator_style(&self) -> Style {
        self.separator
            .style_or(&Theme::internal_defaults().separator)
    }

    pub fn path_style(&self) -> Style {
        self.path.style_or(&Theme::internal_defaults().path)
    }

    pub fn status_line_style(&self) -> Style {
        self.status_line
            .style_or(&Theme::internal_defaults().status_line)
    }

    pub fn symlink(&self) -> Color {
        self.symlink.or(Theme::internal_defaults().symlink)
    }

    // Pane-specific style getters

    pub fn parent_selection_style(&self) -> Style {
        if self.parent.selection_mode == SelectionMode::Off {
            return Style::default();
        }
        self.parent.selection_style(&self.selection)
    }

    pub fn preview_selection_style(&self) -> Style {
        if self.preview.selection_mode == SelectionMode::Off {
            return Style::default();
        }
        self.preview.selection_style(&self.selection)
    }

    pub fn preview_item_style(&self) -> Style {
        self.preview.entry_style(&self.entry)
    }
    pub fn parent_item_style(&self) -> Style {
        self.parent.entry_style(&self.entry)
    }

    // Accessor methods for various theme properties

    pub fn selection_icon(&self) -> &str {
        &self.selection_icon
    }

    pub fn parent(&self) -> &PaneTheme {
        &self.parent
    }

    pub fn preview(&self) -> &PaneTheme {
        &self.preview
    }

    pub fn marker(&self) -> &MarkerTheme {
        &self.marker
    }

    pub fn widget(&self) -> &WidgetTheme {
        &self.widget
    }

    pub fn info(&self) -> &WidgetTheme {
        &self.info
    }

    /// Apply user overrides on top of a preset theme if a known preset name is provided.
    /// If no preset name is provided or the name is unknown, returns the theme as is.
    pub fn with_overrides(self) -> Self {
        let preset = match self.name.as_deref() {
            Some("gruvbox-dark-hard") => Some(gruvbox_dark_hard()),
            Some("gruvbox-dark") => Some(gruvbox_dark()),
            Some("gruvbox-light") => Some(gruvbox_light()),

            Some("catppuccin-mocha") => Some(catppuccin_mocha()),
            Some("catppuccin-frappe") => Some(catppuccin_frappe()),
            Some("catppuccin-macchiato") => Some(catppuccin_mocha()),
            Some("catppuccin-latte") => Some(catppuccin_latte()),

            Some("nord") => Some(nord()),

            Some("two-dark") => Some(two_dark()),
            Some("one-dark") => Some(one_dark()),

            Some("solarized-dark") => Some(solarized_dark()),
            Some("solarized-light") => Some(solarized_light()),

            Some("dracula") => Some(dracula()),

            Some("monokai") => Some(monokai()),

            Some("nightfox") => Some(nightfox()),
            Some("carbonfox") => Some(carbonfox()),

            Some("tokyonight") => Some(tokyonight_night()),
            Some("tokyonight-storm") => Some(tokyonight_storm()),
            Some("tokyonight-day") => Some(tokyonight_day()),

            Some("everforest") => Some(everforest()),
            Some("rose-pine") | Some("rose_pine") => Some(rose_pine()),

            _ => None,
        };

        if let Some(mut base) = preset {
            base.apply_user_overrides(self);
            base
        } else {
            self
        }
    }

    /// Map internal theme name to bat theme name for syntax highlighting.
    /// If no name is set, defaults to "TwoDark".
    /// Returns a static string slice representing the bat theme name.
    pub fn bat_theme_name(&self) -> &'static str {
        self.name
            .as_deref()
            .map(Theme::map_to_bat_theme)
            .unwrap_or("TwoDark")
    }

    /// Helper function to map internal theme names to bat theme names.
    /// Used by bat for syntax highlighting.
    /// # Arguments:
    /// * internal_theme - A string slice representing the internal theme name.
    ///
    /// # Returns:
    /// * A static string slice representing the corresponding bat theme name.
    fn map_to_bat_theme(internal_theme: &str) -> &'static str {
        match internal_theme {
            "default" => "TwoDark",
            "two-dark" => "TwoDark",
            "one-dark" => "OneHalfDark",
            "gruvbox-dark" | "gruvbox-dark-hard" | "gruvbox" => "gruvbox-dark",
            "gruvbox-light" => "gruvbox-light",
            "tokyonight-night" | "tokyonight" | "tokyonight-storm" => "TwoDark",
            "catppuccin-latte" => "Catppuccin Latte",
            "catppuccin-frappe" => "Catppuccin Frappe",
            "catppuccin-macchiato" => "Catppuccin Macchiato",
            "catppuccin-mocha" | "catppuccin" => "Catppuccin Mocha",
            "nightfox" | "carbonfox" | "rose-pine" | "everforest" => "TwoDark",
            "monokai" => "Monokai Extended (default)",
            "nord" => "Nord",
            "solarized-dark" => "Solarized (dark)",
            "solarized-light" => "Solarized (light)",
            "dracula" => "Dracula",
            _ => "TwoDark",
        }
    }

    /// Apply user overrides on top of the current theme.
    /// Compares each field with the default theme and overrides if changed
    /// This allows to only specify the fields they want to change
    fn apply_user_overrides(&mut self, user: Theme) {
        let defaults = Theme::default();

        override_if_changed!(self, user, defaults, accent);
        override_if_changed!(self, user, defaults, selection);
        override_if_changed!(self, user, defaults, underline);
        override_if_changed!(self, user, defaults, entry);
        override_if_changed!(self, user, defaults, directory);
        override_if_changed!(self, user, defaults, separator);
        override_if_changed!(self, user, defaults, parent);
        override_if_changed!(self, user, defaults, preview);
        override_if_changed!(self, user, defaults, path);
        override_if_changed!(self, user, defaults, status_line);
        override_if_changed!(self, user, defaults, symlink);
        override_if_changed!(self, user, defaults, selection_icon);
        override_if_changed!(self, user, defaults, marker);
        override_if_changed!(self, user, defaults, widget);
        override_if_changed!(self, user, defaults, info);

        if user.name.is_some() {
            self.name = user.name.clone();
        }
    }
}

/// ColorPair struct to hold foreground and background colors.
/// Used throughout the theme configuration.
#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
pub struct ColorPair {
    #[serde(default, deserialize_with = "deserialize_color_field")]
    fg: Color,
    #[serde(default, deserialize_with = "deserialize_color_field")]
    bg: Color,
}

/// Default implementation for ColorPair
/// Sets both foreground and background to Color::Reset
impl Default for ColorPair {
    fn default() -> Self {
        Self {
            fg: Color::Reset,
            bg: Color::Reset,
        }
    }
}

/// ColorPair implementation
/// Provides methods to convert to Style and get effective styles.
impl ColorPair {
    /// Resolves the ColorPair by replacing Reset colors with those from another ColorPair.
    pub fn resolve(&self, other: &ColorPair) -> Self {
        Self {
            fg: if self.fg == Color::Reset {
                other.fg
            } else {
                self.fg
            },
            bg: if self.bg == Color::Reset {
                other.bg
            } else {
                self.bg
            },
        }
    }

    /// Converts the ColorPair to a Style, falling back to the provided fallback ColorPair for Reset colors.
    pub fn style_or(&self, fallback: &ColorPair) -> Style {
        let resovled = self.resolve(fallback);
        Style::default().fg(resovled.fg).bg(resovled.bg)
    }
}

#[derive(Deserialize, Debug, Clone, Copy, PartialEq, Default)]
#[serde(rename_all = "lowercase")]
enum SelectionMode {
    #[default]
    On,
    Off,
}

/// PaneTheme struct to hold color and selection styles for panes.
/// Used for parent and preview panes.
#[derive(Deserialize, Debug, PartialEq, Clone, Copy, Default)]
#[serde(default)]
pub struct PaneTheme {
    #[serde(flatten)]
    color: ColorPair,
    selection: Option<ColorPair>,
    selection_mode: SelectionMode,
}

/// Similar to ColorPair implementation
/// Provides methods to convert to Style and get effective styles.
impl PaneTheme {
    /// Returns the selection style, falling back to the provided fallback if not set.
    /// If selection is None, falls back to the provided fallback ColorPair.
    /// If selection is Some, uses its style_or method with the fallback.
    ///
    /// # Arguments
    /// * `fallback` - A `ColorPair` to use if selection is None.
    /// # Returns
    /// * `Style` - A `Style` representing the selection style.
    pub fn selection_style(&self, fallback: &ColorPair) -> Style {
        let default = &Theme::internal_defaults().selection;
        match self.selection {
            Some(pane_sel) => pane_sel.style_or(&fallback.resolve(default)),
            None => fallback.style_or(default),
        }
    }

    /// Returns the entry style, falling back to the provided fallback ColorPair.
    /// If entry color is Reset, uses the fallback.
    ///
    /// # Arguments
    /// * `fallback` - A `ColorPair` to use as fallback.
    /// # Returns
    /// * `Style` - A `Style` representing the entry style.
    pub fn entry_style(&self, fallback: &ColorPair) -> Style {
        self.color.style_or(fallback)
    }

    /// Returns the pane color style, falling back to the provided fallback ColorPair.
    /// # Arguments
    /// * `fallback` - A `ColorPair` to use as fallback.
    /// # Returns
    /// * `Style` - A `Style` representing the pane color style.
    pub fn style_or(&self, fallback: &ColorPair) -> Style {
        self.color.style_or(fallback)
    }

    /// Returns the pane color style, falling back to the internal default theme's entry style.
    /// This method uses the internal default theme as the fallback.
    pub fn effective_style_or_theme(&self) -> Style {
        self.style_or(&Theme::internal_defaults().entry)
    }
}

/// MarkerTheme struct to hold marker icon and colors.
#[derive(Deserialize, Debug, Clone, PartialEq)]
#[serde(default)]
pub struct MarkerTheme {
    icon: String,
    #[serde(flatten)]
    color: ColorPair,
    /// Optional clipboard color pair
    /// sets the color of the copy/paste marker
    clipboard: Option<ColorPair>,
}

impl MarkerTheme {
    /// Returns the marker icon.
    pub fn icon(&self) -> &str {
        &self.icon
    }

    /// Returns the marker style, falling back to the internal default theme if colors are Reset.
    pub fn style_or_theme(&self) -> Style {
        self.color.style_or(&MarkerTheme::default().color)
    }

    /// Returns the clipboard marker style, falling back to the marker style if clipboard is None.
    pub fn clipboard_style_or_theme(&self) -> Style {
        match &self.clipboard {
            Some(c) => c.style_or(&MarkerTheme::default().clipboard.unwrap()),
            None => self.style_or_theme(),
        }
    }
}

impl Default for MarkerTheme {
    fn default() -> Self {
        MarkerTheme {
            icon: "*".to_string(),
            color: ColorPair {
                fg: Color::Yellow,
                bg: Color::Reset,
            },
            clipboard: Some(ColorPair {
                fg: Color::Green,
                bg: Color::Reset,
            }),
        }
    }
}

/// WidgetTheme struct to hold colors and styles for widgets/dialogs.
/// Used by various dialog widgets and overlay widgets.
#[derive(Deserialize, Debug, Clone, PartialEq)]
#[serde(default)]
pub struct WidgetTheme {
    color: ColorPair,
    border: ColorPair,
    title: ColorPair,
    position: Option<DialogPosition>,
    size: Option<DialogSize>,
    confirm_size: Option<DialogSize>,
    find_visible_results: Option<usize>,
    find_width: Option<u16>,
}

impl WidgetTheme {
    pub fn position(&self) -> &Option<DialogPosition> {
        &self.position
    }

    pub fn size(&self) -> &Option<DialogSize> {
        &self.size
    }

    pub fn confirm_size(&self) -> &Option<DialogSize> {
        &self.confirm_size
    }

    /// Returns the confirm dialog size, falling back to the general size, and then to the provided fallback.
    pub fn confirm_size_or(&self, fallback: DialogSize) -> DialogSize {
        self.confirm_size()
            .as_ref()
            .or_else(|| self.size().as_ref())
            .copied()
            .unwrap_or(fallback)
    }

    /// Returns the border style, falling back to the provided style for Reset colors.
    pub fn border_style_or(&self, fallback: Style) -> Style {
        self.border.style_or(&ColorPair {
            fg: fallback.fg.unwrap_or(Color::Reset),
            bg: fallback.bg.unwrap_or(Color::Reset),
        })
    }

    /// Returns the foreground style, falling back to the provided style if Reset.
    pub fn fg_or(&self, fallback: Style) -> Style {
        self.color.style_or(&ColorPair {
            fg: fallback.fg.unwrap_or(Color::Reset),
            bg: fallback.bg.unwrap_or(Color::Reset),
        })
    }

    /// Returns the background style, falling back to the provided style if Reset.
    pub fn bg_or(&self, fallback: Style) -> Style {
        self.color.style_or(&ColorPair {
            fg: fallback.fg.unwrap_or(Color::Reset),
            bg: fallback.bg.unwrap_or(Color::Reset),
        })
    }

    /// Returns the foreground style, falling back to the internal default theme if Reset.
    pub fn fg_or_theme(&self) -> Style {
        self.fg_or(Style::default().fg(Theme::internal_defaults().info.color.fg))
    }

    /// Returns the background style, falling back to the internal default theme if Reset.
    pub fn bg_or_theme(&self) -> Style {
        self.bg_or(Style::default().bg(Theme::internal_defaults().info.color.bg))
    }

    /// Returns the title style, falling back to the provided style for Reset colors.
    pub fn title_style_or(&self, fallback: Style) -> Style {
        self.title.style_or(&ColorPair {
            fg: fallback.fg.unwrap_or(Color::Reset),
            bg: fallback.bg.unwrap_or(Color::Reset),
        })
    }

    /// Returns the title style, falling back to the internal default theme if Reset.
    pub fn title_style_or_theme(&self) -> Style {
        self.title.style_or(&Theme::internal_defaults().info.title)
    }

    /// Returns the number of visible results in the find dialog, falling back to the provided fallback.
    pub fn find_visible_or(&self, fallback: usize) -> usize {
        self.find_visible_results.unwrap_or(fallback)
    }

    /// Returns the width of the find dialog, falling back to the provided fallback.
    pub fn find_width_or(&self, fallback: u16) -> u16 {
        self.find_width.unwrap_or(fallback)
    }
}

/// Default implementation for WidgetTheme
impl Default for WidgetTheme {
    fn default() -> Self {
        WidgetTheme {
            color: ColorPair::default(),
            border: ColorPair::default(),
            title: ColorPair::default(),
            position: Some(DialogPosition::Center),
            size: Some(DialogSize::Small),
            confirm_size: Some(DialogSize::Large),
            find_visible_results: Some(5),
            find_width: Some(40),
        }
    }
}

/// Trait to provide a fallback color if the original color is Reset.
/// Is used when a field is Color::Reset to fallback to another color.
/// Useful for when a field is ratatui::style::Color instead of ColorPair.
trait ColorFallback {
    fn or(self, fallback: Color) -> Color;
}

/// Implementation of ColorFallback for Color.
/// If the color is Reset, returns the fallback color, otherwise returns self.
impl ColorFallback for Color {
    fn or(self, fallback: Color) -> Color {
        if let Color::Reset = self {
            fallback
        } else {
            self
        }
    }
}

// Helper function to deserialize Theme colors
fn deserialize_color_field<'de, D>(deserializer: D) -> Result<Color, D::Error>
where
    D: serde::Deserializer<'de>,
{
    let s = String::deserialize(deserializer)?;
    Ok(parse_color(&s))
}

/// Helper function to convert RGB tuples to [Color] instances.
fn rgb(c: (u8, u8, u8)) -> Color {
    Color::Rgb(c.0, c.1, c.2)
}

/// Palette struct to apply internal themes to the central [make_theme] function.
pub struct Palette {
    pub base: (u8, u8, u8),
    pub surface: (u8, u8, u8),
    pub overlay: (u8, u8, u8),
    pub primary: (u8, u8, u8),
    pub secondary: (u8, u8, u8),
    pub directory: (u8, u8, u8),
}

/// Centralized function to create a Theme from a Palette.
/// Used by all internal themes to avoid code duplication.
///
/// # Arguments
/// * `name` - A string slice representing the name of the theme.
/// * `palette` - A Palette struct containing the color definitions for the theme.
/// * `icon` - A string slice representing the marker icon for the theme.
///
/// # Returns
/// * `Theme` - A Theme instance created from the provided palette
pub fn make_theme(name: &str, palette: Palette, icon: &str) -> Theme {
    let primary = rgb(palette.primary);
    let secondary = rgb(palette.secondary);
    let muted = rgb(palette.overlay);
    let struct_color = rgb(palette.surface);
    let base_bg = rgb(palette.base);
    let dir_color = rgb(palette.directory);

    Theme {
        name: Some(name.to_string()),
        accent: ColorPair {
            fg: struct_color,
            ..ColorPair::default()
        },
        selection: ColorPair {
            bg: struct_color,
            ..ColorPair::default()
        },
        directory: ColorPair {
            fg: dir_color,
            ..ColorPair::default()
        },
        separator: ColorPair {
            fg: struct_color,
            ..ColorPair::default()
        },
        path: ColorPair {
            fg: muted,
            ..ColorPair::default()
        },
        status_line: ColorPair {
            fg: Color::Reset,
            bg: base_bg,
        },
        symlink: secondary,
        marker: MarkerTheme {
            icon: icon.to_string(),
            color: ColorPair {
                fg: primary,
                ..ColorPair::default()
            },
            clipboard: Some(ColorPair {
                fg: secondary,
                ..ColorPair::default()
            }),
        },

        widget: WidgetTheme {
            title: ColorPair {
                fg: muted,
                ..ColorPair::default()
            },
            border: ColorPair {
                fg: struct_color,
                ..ColorPair::default()
            },
            ..WidgetTheme::default()
        },
        info: WidgetTheme {
            title: ColorPair {
                fg: secondary,
                ..ColorPair::default()
            },
            border: ColorPair {
                fg: struct_color,
                ..ColorPair::default()
            },
            ..WidgetTheme::default()
        },
        ..Theme::default()
    }
}