|
| 1 | +local util = require "astrotheme.extras" |
| 2 | + |
| 3 | +local M = {} |
| 4 | + |
| 5 | +--- @param colors AstroThemePalette |
| 6 | +function M.generate(colors) |
| 7 | + local function normalize_colors(_colors) |
| 8 | + local new_colors = {} |
| 9 | + for k, v in pairs(_colors) do |
| 10 | + new_colors[k] = type(v) == "string" and v:gsub("^#", "") or normalize_colors(v) |
| 11 | + end |
| 12 | + return new_colors |
| 13 | + end |
| 14 | + return util.template( |
| 15 | + [[ |
| 16 | + # ${_style_name} Color Palette |
| 17 | + set -l foreground ${syntax.text} |
| 18 | + set -l selection ${ui.selection} |
| 19 | + set -l comment ${syntax.comment} |
| 20 | + set -l red ${syntax.red} |
| 21 | + set -l orange ${syntax.orange} |
| 22 | + set -l yellow ${syntax.yellow} |
| 23 | + set -l green ${syntax.green} |
| 24 | + set -l purple ${syntax.purple} |
| 25 | + set -l cyan ${syntax.cyan} |
| 26 | + set -l pink ${syntax.purple} |
| 27 | +
|
| 28 | + # Syntax Highlighting Colors |
| 29 | + set -g fish_color_normal $foreground |
| 30 | + set -g fish_color_command $cyan |
| 31 | + set -g fish_color_keyword $pink |
| 32 | + set -g fish_color_quote $yellow |
| 33 | + set -g fish_color_redirection $foreground |
| 34 | + set -g fish_color_end $orange |
| 35 | + set -g fish_color_error $red |
| 36 | + set -g fish_color_param $purple |
| 37 | + set -g fish_color_comment $comment |
| 38 | + set -g fish_color_selection --background=$selection |
| 39 | + set -g fish_color_search_match --background=$selection |
| 40 | + set -g fish_color_operator $green |
| 41 | + set -g fish_color_escape $pink |
| 42 | + set -g fish_color_autosuggestion $comment |
| 43 | +
|
| 44 | + # Completion Pager Colors |
| 45 | + set -g fish_pager_color_progress $comment |
| 46 | + set -g fish_pager_color_prefix $cyan |
| 47 | + set -g fish_pager_color_completion $foreground |
| 48 | + set -g fish_pager_color_description $comment |
| 49 | + set -g fish_pager_color_selected_background --background=$selection |
| 50 | +]], |
| 51 | + normalize_colors(colors) |
| 52 | + ) |
| 53 | +end |
| 54 | + |
| 55 | +return M |
0 commit comments