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.
This commit is contained in:
Aaron Gyes 2022-01-27 16:38:14 -08:00
parent c6166f8ced
commit 03b23dd1b6
2 changed files with 47 additions and 46 deletions

View file

@ -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

View file

@ -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