From 03b23dd1b659467c4f25b337a9aafa6910783ba2 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Thu, 27 Jan 2022 16:38:14 -0800 Subject: [PATCH] Update default colors - Use named colors instead of hex values - not sure how this happened in the first place, these all map to basic named colors. - Reinitialize if these were last set on fish <3.4, new variables have been added. - Break this into a separate function for the sake of __fish_config_interactive complexity, and allow for running manually. --- .../functions/__fish_config_interactive.fish | 49 ++----------------- share/functions/fish_initialize_colors.fish | 44 +++++++++++++++++ 2 files changed, 47 insertions(+), 46 deletions(-) create mode 100644 share/functions/fish_initialize_colors.fish diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index d148dc280..0b2e2518f 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -26,52 +26,9 @@ function __fish_config_interactive -d "Initializations that should be performed end end - # # If we are starting up for the first time, set various defaults. - if test $__fish_initialized -lt 3100 - - # Regular syntax highlighting colors - __init_uvar fish_color_normal normal - __init_uvar fish_color_command 005fd7 - __init_uvar fish_color_param 00afff - __init_uvar fish_color_redirection 00afff - __init_uvar fish_color_comment 990000 - __init_uvar fish_color_error ff0000 - __init_uvar fish_color_escape 00a6b2 - __init_uvar fish_color_operator 00a6b2 - __init_uvar fish_color_end 009900 - __init_uvar fish_color_quote 999900 - __init_uvar fish_color_autosuggestion 555 brblack - __init_uvar fish_color_user brgreen - __init_uvar fish_color_host normal - __init_uvar fish_color_host_remote yellow - __init_uvar fish_color_valid_path --underline - __init_uvar fish_color_status red - - __init_uvar fish_color_cwd green - __init_uvar fish_color_cwd_root red - - # Background color for search matches - __init_uvar fish_color_search_match bryellow --background=brblack - - # Background color for selections - __init_uvar fish_color_selection white --bold --background=brblack - - # XXX fish_color_cancel was added in 2.6, but this was added to post-2.3 initialization - # when 2.4 and 2.5 were already released - __init_uvar fish_color_cancel -r - - # Pager colors - __init_uvar fish_pager_color_prefix normal --bold --underline - __init_uvar fish_pager_color_completion - __init_uvar fish_pager_color_description B3A06D yellow - __init_uvar fish_pager_color_progress brwhite --background=cyan - __init_uvar fish_pager_color_selected_background -r - - # - # Directory history colors - # - __init_uvar fish_color_history_current --bold + if test $__fish_initialized -lt 3400 + fish_initialize_colors end # @@ -283,5 +240,5 @@ end" >$__fish_config_dir/config.fish # Bump this whenever some code below needs to run once when upgrading to a new version. # The universal variable __fish_initialized is initialized in share/config.fish. - set __fish_initialized 3100 + set __fish_initialized 3400 end diff --git a/share/functions/fish_initialize_colors.fish b/share/functions/fish_initialize_colors.fish new file mode 100644 index 000000000..c9a3af5c2 --- /dev/null +++ b/share/functions/fish_initialize_colors.fish @@ -0,0 +1,44 @@ +function fish_initialize_colors -d "Set default color uvars" + # Regular syntax highlighting colors + __init_uvar fish_color_normal normal + __init_uvar fish_color_command blue + __init_uvar fish_color_param cyan + __init_uvar fish_color_redirection cyan --bold + __init_uvar fish_color_comment red + __init_uvar fish_color_error brred + __init_uvar fish_color_escape brcyan + __init_uvar fish_color_operator brcyan + __init_uvar fish_color_end green + __init_uvar fish_color_quote yellow + __init_uvar fish_color_autosuggestion 555 brblack + __init_uvar fish_color_user brgreen + __init_uvar fish_color_host normal + __init_uvar fish_color_host_remote yellow + __init_uvar fish_color_valid_path --underline + __init_uvar fish_color_status red + + __init_uvar fish_color_cwd green + __init_uvar fish_color_cwd_root red + + # Background color for search matches + __init_uvar fish_color_search_match --background=111 + + # Background color for selections + __init_uvar fish_color_selection white --bold --background=brblack + + # XXX fish_color_cancel was added in 2.6, but this was added to post-2.3 initialization + # when 2.4 and 2.5 were already released + __init_uvar fish_color_cancel -r + + # Pager colors + __init_uvar fish_pager_color_prefix normal --bold --underline + __init_uvar fish_pager_color_completion 888 + __init_uvar fish_pager_color_description B3A06D yellow + __init_uvar fish_pager_color_progress brwhite --background=cyan + __init_uvar fish_pager_color_selected_background --background=111 + + # + # Directory history colors + # + __init_uvar fish_color_history_current --bold +end