navi

Obsidian-style interactive graph viewer for org-roam — native window, no Emacs package required.
Log | Files | Refs | README

theme.rs (15627B)


      1 use egui::Color32;
      2 
      3 #[derive(Clone, Copy, Debug)]
      4 pub struct Theme {
      5     pub name: &'static str,
      6     pub bg:        Color32,
      7     pub grid:      Color32,
      8     pub edge:      Color32,
      9     pub edge_hi:   Color32,
     10     pub node:      Color32,
     11     pub node_rim:  Color32,
     12     pub node_hov:  Color32,
     13     pub node_sel:  Color32,
     14     pub node_selr: Color32,
     15     pub label:     Color32,
     16     pub label_hov: Color32,
     17     pub bar_bg:    Color32,
     18     pub bar_line:  Color32,
     19     pub bar_text:  Color32,
     20 }
     21 
     22 impl Theme {
     23     pub fn glow(&self) -> Color32 {
     24         let c = self.node;
     25         Color32::from_rgba_unmultiplied(c.r(), c.g(), c.b(), 28)
     26     }
     27 }
     28 
     29 // ── Navi palette ──────────────────────────────────────────────────────────────
     30 // Source: macro photo of a black butterfly on vivid blue salvia flowers with a
     31 // glowing cyan bokeh orb.  All five Navi variants share the same background
     32 // architecture, bar, labels, and amber complement anchor.  Only nodes, edges,
     33 // and highlights differ — each drawn from a different family in the palette.
     34 
     35 // Shared background infrastructure (same across all Navi variants)
     36 //   bg       #101e2e  Deep Night Blue    (btop main_bg)
     37 //   grid     #192e48  Dark Cerulean      (btop meter_bg — one luminance step up)
     38 //   bar_bg   #0a1c34  Oxford Blue        (btop inactive_bg)
     39 //   bar_line #265080  Payne's Grey blue  (btop div_line)
     40 //   bar_text #a8c8d8  Powder Blue        (btop graph_text)
     41 //   label    #7898b8  Cadet Grey         (btop inactive_fg)
     42 //   label_hov#e0f0ff  Alice Blue         (btop main_fg)
     43 //   node_sel #f09030  Amber              (complement anchor — the one warm hue)
     44 
     45 pub const THEMES: &[Theme] = &[
     46     // ── 0 · Salvia ────────────────────────────────────────────────────────────
     47     // Periwinkle nodes / Electric Cyan ghost-light rim.
     48     // The salvia flowers (electric periwinkle #5578ff) meet the bokeh orb
     49     // (#40e8ff) — the signature Navi look.
     50     Theme {
     51         name: "Salvia",
     52         bg:        Color32::from_rgb( 16,  30,  46),  // #101e2e Deep Night Blue
     53         grid:      Color32::from_rgb( 25,  46,  72),  // #192e48 Dark Cerulean
     54         edge:      Color32::from_rgb( 38,  80, 128),  // #265080 Payne's Grey blue
     55         edge_hi:   Color32::from_rgb( 64, 232, 255),  // #40e8ff Electric Cyan
     56         node:      Color32::from_rgb( 85, 120, 255),  // #5578ff Electric Periwinkle
     57         node_rim:  Color32::from_rgb( 64, 232, 255),  // #40e8ff Electric Cyan
     58         node_hov:  Color32::from_rgb(  0, 216, 248),  // #00d8f8 Vivid Cerulean
     59         node_sel:  Color32::from_rgb(240, 144,  48),  // #f09030 Amber
     60         node_selr: Color32::from_rgb(156, 242, 255),  // #9cf2ff soft cyan — rim brightened
     61         label:     Color32::from_rgb(120, 152, 184),  // #7898b8 Cadet Grey
     62         label_hov: Color32::from_rgb(224, 240, 255),  // #e0f0ff Alice Blue
     63         bar_bg:    Color32::from_rgb( 10,  28,  52),  // #0a1c34 Oxford Blue
     64         bar_line:  Color32::from_rgb( 38,  80, 128),  // #265080 Payne's Grey blue
     65         bar_text:  Color32::from_rgb(168, 200, 216),  // #a8c8d8 Powder Blue
     66     },
     67     // ── 1 · Bokeh ─────────────────────────────────────────────────────────────
     68     // Pure cyan family — the glowing bokeh orb made into nodes.
     69     // Pacific Blue nodes (#00b8d8) ringed in Electric Cyan (#40e8ff).
     70     // Edges pull from Deep Teal (#023040), the darkest cyan bg in the palette.
     71     Theme {
     72         name: "Bokeh",
     73         bg:        Color32::from_rgb( 16,  30,  46),  // #101e2e
     74         grid:      Color32::from_rgb( 25,  46,  72),  // #192e48
     75         edge:      Color32::from_rgb( 26,  96, 112),  // #1a6070 mid teal
     76         edge_hi:   Color32::from_rgb( 64, 232, 255),  // #40e8ff Electric Cyan
     77         node:      Color32::from_rgb(  0, 184, 216),  // #00b8d8 Pacific Blue
     78         node_rim:  Color32::from_rgb( 64, 232, 255),  // #40e8ff Electric Cyan
     79         node_hov:  Color32::from_rgb(  0, 216, 248),  // #00d8f8 Vivid Cerulean
     80         node_sel:  Color32::from_rgb(240, 144,  48),  // #f09030 Amber
     81         node_selr: Color32::from_rgb(156, 242, 255),  // #9cf2ff soft cyan — rim brightened
     82         label:     Color32::from_rgb(120, 152, 184),  // #7898b8 Cadet Grey
     83         label_hov: Color32::from_rgb(224, 240, 255),  // #e0f0ff Alice Blue
     84         bar_bg:    Color32::from_rgb( 10,  28,  52),  // #0a1c34 Oxford Blue
     85         bar_line:  Color32::from_rgb( 38,  80, 128),  // #265080 Payne's Grey blue
     86         bar_text:  Color32::from_rgb(168, 200, 216),  // #a8c8d8 Powder Blue
     87     },
     88     // ── 2 · Stem ──────────────────────────────────────────────────────────────
     89     // The cool stem greens beneath the salvia flowers.
     90     // Caribbean Green nodes (#00e898) / Aquamarine rim (#00f0b0).
     91     // Edges from Hunter Green (#052818) — darkest green bg in the palette.
     92     Theme {
     93         name: "Stem",
     94         bg:        Color32::from_rgb( 16,  30,  46),  // #101e2e
     95         grid:      Color32::from_rgb( 25,  46,  72),  // #192e48
     96         edge:      Color32::from_rgb( 20, 100,  56),  // #146438 mid green
     97         edge_hi:   Color32::from_rgb(  0, 240, 176),  // #00f0b0 Aquamarine
     98         node:      Color32::from_rgb(  0, 232, 152),  // #00e898 Caribbean Green
     99         node_rim:  Color32::from_rgb(  0, 240, 176),  // #00f0b0 Aquamarine
    100         node_hov:  Color32::from_rgb( 64, 216, 112),  // #40d870 Malachite
    101         node_sel:  Color32::from_rgb(240, 144,  48),  // #f09030 Amber
    102         node_selr: Color32::from_rgb(128, 248, 216),  // #80f8d8 soft aqua — rim brightened
    103         label:     Color32::from_rgb(120, 152, 184),  // #7898b8 Cadet Grey
    104         label_hov: Color32::from_rgb(224, 240, 255),  // #e0f0ff Alice Blue
    105         bar_bg:    Color32::from_rgb( 10,  28,  52),  // #0a1c34 Oxford Blue
    106         bar_line:  Color32::from_rgb( 38,  80, 128),  // #265080 Payne's Grey blue
    107         bar_text:  Color32::from_rgb(168, 200, 216),  // #a8c8d8 Powder Blue
    108     },
    109     // ── 3 · Petal ─────────────────────────────────────────────────────────────
    110     // The iridescent wing of the black butterfly — violet and magenta.
    111     // Amethyst nodes (#a868d8) / Electric Violet rim (#c040f8).
    112     // Edges from Violet Black (#1e0a48) — darkest magenta bg in the palette.
    113     Theme {
    114         name: "Petal",
    115         bg:        Color32::from_rgb( 16,  30,  46),  // #101e2e
    116         grid:      Color32::from_rgb( 25,  46,  72),  // #192e48
    117         edge:      Color32::from_rgb( 72,  24, 144),  // #481890 Dark Indigo
    118         edge_hi:   Color32::from_rgb(224,  48, 255),  // #e030ff Electric Magenta
    119         node:      Color32::from_rgb(168, 104, 216),  // #a868d8 Amethyst
    120         node_rim:  Color32::from_rgb(192,  64, 248),  // #c040f8 Electric Violet
    121         node_hov:  Color32::from_rgb(224,  48, 255),  // #e030ff Electric Magenta
    122         node_sel:  Color32::from_rgb(240, 144,  48),  // #f09030 Amber
    123         node_selr: Color32::from_rgb(223, 159, 251),  // #df9ffb soft lavender — rim brightened
    124         label:     Color32::from_rgb(120, 152, 184),  // #7898b8 Cadet Grey
    125         label_hov: Color32::from_rgb(224, 240, 255),  // #e0f0ff Alice Blue
    126         bar_bg:    Color32::from_rgb( 10,  28,  52),  // #0a1c34 Oxford Blue
    127         bar_line:  Color32::from_rgb( 38,  80, 128),  // #265080 Payne's Grey blue
    128         bar_text:  Color32::from_rgb(168, 200, 216),  // #a8c8d8 Powder Blue
    129     },
    130     // ── 4 · Azure ─────────────────────────────────────────────────────────────
    131     // The deeper blue-cooler family — calmer than Salvia, still fully Navi.
    132     // Cobalt Blue nodes (#3d7fff) / Azure Blue rim (#1a9aff).
    133     // Edges from Midnight Indigo (#082060).
    134     Theme {
    135         name: "Azure",
    136         bg:        Color32::from_rgb( 16,  30,  46),  // #101e2e
    137         grid:      Color32::from_rgb( 25,  46,  72),  // #192e48
    138         edge:      Color32::from_rgb( 24,  56, 160),  // #1838a0 Ultramarine
    139         edge_hi:   Color32::from_rgb( 26, 154, 255),  // #1a9aff Azure Blue
    140         node:      Color32::from_rgb( 61, 127, 255),  // #3d7fff Cobalt Blue
    141         node_rim:  Color32::from_rgb( 26, 154, 255),  // #1a9aff Azure Blue
    142         node_hov:  Color32::from_rgb( 64, 232, 255),  // #40e8ff Electric Cyan
    143         node_sel:  Color32::from_rgb(240, 144,  48),  // #f09030 Amber
    144         node_selr: Color32::from_rgb(140, 204, 255),  // #8cccff soft sky blue — rim brightened
    145         label:     Color32::from_rgb(120, 152, 184),  // #7898b8 Cadet Grey
    146         label_hov: Color32::from_rgb(224, 240, 255),  // #e0f0ff Alice Blue
    147         bar_bg:    Color32::from_rgb( 10,  28,  52),  // #0a1c34 Oxford Blue
    148         bar_line:  Color32::from_rgb( 38,  80, 128),  // #265080 Payne's Grey blue
    149         bar_text:  Color32::from_rgb(168, 200, 216),  // #a8c8d8 Powder Blue
    150     },
    151     // ── 5 · Ruby ──────────────────────────────────────────────────────────────
    152     // Fully independent background — wine-dark near-black (#1a0810) so the
    153     // crimson nodes feel emitted rather than placed.  Cool-shifted ruby crimson
    154     // (192, 24, 64) follows the palette rule: reds bent toward blue.
    155     // Rim: Flamingo (#f85888).  Connections: Claret (#6a1018).
    156     // Selection flips the complement — Electric Cyan (#40e8ff) glows against
    157     // warm red the same way amber glows against cool blue in the other variants.
    158     Theme {
    159         name: "Ruby",
    160         bg:        Color32::from_rgb( 26,   8,  16),  // #1a0810 wine-dark near-black
    161         grid:      Color32::from_rgb( 56,  16,  28),  // #38101c dark maroon
    162         edge:      Color32::from_rgb(106,  16,  24),  // #6a1018 Claret
    163         edge_hi:   Color32::from_rgb(255,  96,  96),  // #ff6060 Bittersweet
    164         node:      Color32::from_rgb(192,  24,  64),  // deep ruby crimson
    165         node_rim:  Color32::from_rgb(248,  88, 136),  // #f85888 Flamingo
    166         node_hov:  Color32::from_rgb(255,  96,  96),  // #ff6060 Bittersweet
    167         node_sel:  Color32::from_rgb( 64, 232, 255),  // #40e8ff Electric Cyan — cool complement
    168         node_selr: Color32::from_rgb(251, 168, 192),  // #fba8c0 soft rose — rim brightened
    169         label:     Color32::from_rgb(184, 136, 152),  // warm rose-grey
    170         label_hov: Color32::from_rgb(240, 220, 228),  // warm near-white
    171         bar_bg:    Color32::from_rgb( 16,   4,   8),  // #100408 near-black
    172         bar_line:  Color32::from_rgb(106,  16,  24),  // #6a1018 Claret
    173         bar_text:  Color32::from_rgb(200, 120, 120),  // #c87878 Dusty Rose
    174     },
    175     // ── Legacy themes ─────────────────────────────────────────────────────────
    176     Theme {
    177         name: "Obsidian",
    178         bg:        Color32::from_rgb( 13,  13,  20),
    179         grid:      Color32::from_rgb( 48,  48,  75),
    180         edge:      Color32::from_rgb( 60,  60, 100),
    181         edge_hi:   Color32::from_rgb(160, 110, 255),
    182         node:      Color32::from_rgb(124,  77, 255),
    183         node_rim:  Color32::from_rgb(175, 140, 255),
    184         node_hov:  Color32::from_rgb(185, 155, 255),
    185         node_sel:  Color32::from_rgb(255, 200,  40),
    186         node_selr: Color32::from_rgb(212, 192, 255),  // #d4c0ff soft pale purple — rim brightened
    187         label:     Color32::from_rgb(185, 180, 215),
    188         label_hov: Color32::from_rgb(255, 255, 255),
    189         bar_bg:    Color32::from_rgb( 18,  18,  30),
    190         bar_line:  Color32::from_rgb( 48,  48,  75),
    191         bar_text:  Color32::from_rgb(140, 135, 175),
    192     },
    193     Theme {
    194         name: "Forest",
    195         bg:        Color32::from_rgb(  8,  18,  10),
    196         grid:      Color32::from_rgb( 32,  60,  36),
    197         edge:      Color32::from_rgb( 40,  80,  50),
    198         edge_hi:   Color32::from_rgb( 80, 220, 100),
    199         node:      Color32::from_rgb( 50, 180,  80),
    200         node_rim:  Color32::from_rgb(100, 220, 130),
    201         node_hov:  Color32::from_rgb( 80, 200, 110),
    202         node_sel:  Color32::from_rgb(255, 200,  40),
    203         node_selr: Color32::from_rgb(176, 238, 192),  // #b0eec0 soft mint — rim brightened
    204         label:     Color32::from_rgb(170, 210, 175),
    205         label_hov: Color32::from_rgb(220, 255, 220),
    206         bar_bg:    Color32::from_rgb( 12,  24,  14),
    207         bar_line:  Color32::from_rgb( 30,  60,  35),
    208         bar_text:  Color32::from_rgb(120, 175, 130),
    209     },
    210     Theme {
    211         name: "Ocean",
    212         bg:        Color32::from_rgb(  8,  14,  28),
    213         grid:      Color32::from_rgb( 28,  50,  88),
    214         edge:      Color32::from_rgb( 30,  60, 110),
    215         edge_hi:   Color32::from_rgb( 60, 150, 255),
    216         node:      Color32::from_rgb( 40, 130, 220),
    217         node_rim:  Color32::from_rgb( 80, 170, 250),
    218         node_hov:  Color32::from_rgb( 60, 155, 240),
    219         node_sel:  Color32::from_rgb(255, 200,  40),
    220         node_selr: Color32::from_rgb(168, 212, 252),  // #a8d4fc soft periwinkle — rim brightened
    221         label:     Color32::from_rgb(160, 190, 225),
    222         label_hov: Color32::from_rgb(200, 230, 255),
    223         bar_bg:    Color32::from_rgb( 12,  20,  38),
    224         bar_line:  Color32::from_rgb( 28,  50,  90),
    225         bar_text:  Color32::from_rgb(100, 145, 195),
    226     },
    227     Theme {
    228         name: "Ember",
    229         bg:        Color32::from_rgb( 20,  10,   8),
    230         grid:      Color32::from_rgb( 68,  34,  26),
    231         edge:      Color32::from_rgb(100,  40,  20),
    232         edge_hi:   Color32::from_rgb(255, 100,  50),
    233         node:      Color32::from_rgb(220,  80,  40),
    234         node_rim:  Color32::from_rgb(250, 130,  80),
    235         node_hov:  Color32::from_rgb(240, 105,  60),
    236         node_sel:  Color32::from_rgb(255, 240,  40),
    237         node_selr: Color32::from_rgb(252, 192, 168),  // #fcc0a8 soft peach — rim brightened
    238         label:     Color32::from_rgb(215, 185, 170),
    239         label_hov: Color32::from_rgb(255, 240, 230),
    240         bar_bg:    Color32::from_rgb( 28,  14,  10),
    241         bar_line:  Color32::from_rgb( 60,  30,  20),
    242         bar_text:  Color32::from_rgb(175, 135, 120),
    243     },
    244     Theme {
    245         name: "Mono",
    246         bg:        Color32::from_rgb( 12,  12,  12),
    247         grid:      Color32::from_rgb( 50,  50,  50),
    248         edge:      Color32::from_rgb( 80,  80,  80),
    249         edge_hi:   Color32::from_rgb(200, 200, 200),
    250         node:      Color32::from_rgb(170, 170, 170),
    251         node_rim:  Color32::from_rgb(210, 210, 210),
    252         node_hov:  Color32::from_rgb(200, 200, 200),
    253         node_sel:  Color32::from_rgb(255, 200,  40),
    254         node_selr: Color32::from_rgb(232, 232, 232),  // #e8e8e8 soft silver-white — rim brightened
    255         label:     Color32::from_rgb(175, 175, 175),
    256         label_hov: Color32::from_rgb(240, 240, 240),
    257         bar_bg:    Color32::from_rgb( 18,  18,  18),
    258         bar_line:  Color32::from_rgb( 45,  45,  45),
    259         bar_text:  Color32::from_rgb(130, 130, 130),
    260     },
    261 ];