From 5cc953b18dac4ee525fe66889923f05b5a68d532 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 25 Nov 2025 12:52:39 +0100 Subject: [PATCH] Default theme variants specialized for light/dark mode Start by converting the "default" theme's colors to RGB, using XTerm colors since they are simple, see https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit. Then make the following changes: for both default-light and default-dark: - Reinstate fish_color_command/fish_color_keyword as blue since one of the reasons in 81ff6db62db (default color scheme: Make commands "normal" color, 2024-10-02) doesn't hold anymore. - bravely replace "fish_pager_color_selected_background -r" with something that hopefully matches better. Note we can't trivially use the fallback to "fish_color_search_match", since for unknown reasons, "fish_pager_color_selected_background" is only for background and the others are for foreground. for default-light: - brgreen (00ff00) looks bad on light background, so replace it with green (00cd00). This means that we no longer use two different shades of green in the default theme (which helps address the "fruit salad" mentioned 81ff6db62db). - yellow (cdcd00) looks bad on light background, make it darker (a0a000) - fish_pager_color_progress's --background=cyan (00cdcd) seems a bit too bright, make it darker - same for other uses of cyan (also for consistency) - this means fish_color_operator / fish_color_escape can use 00cdcd I guess. for default-dark: - use bright green (00ff00) for all greens - use bright blue (5c5cff) instead of regular blue for command/keyword - make autosuggestions a bit lighter (9f9f9f instead of 7f7f7f) - etc.. I think I made the two themes mostly symmetrical. Part of #11580 --- .../web_config/themes/default-dark.theme | 34 +++++++++++++++++++ .../web_config/themes/default-light.theme | 34 +++++++++++++++++++ tests/checks/fish_config.fish | 10 +++++- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 share/tools/web_config/themes/default-dark.theme create mode 100644 share/tools/web_config/themes/default-light.theme diff --git a/share/tools/web_config/themes/default-dark.theme b/share/tools/web_config/themes/default-dark.theme new file mode 100644 index 000000000..a74736cb9 --- /dev/null +++ b/share/tools/web_config/themes/default-dark.theme @@ -0,0 +1,34 @@ +# name: fish default (dark mode) +# preferred_background: 000000 + +fish_color_normal ffffff +fish_color_autosuggestion 9f9f9f +fish_color_cancel 000000 --background=ffffff +fish_color_command 5c5cff +fish_color_comment 00cd00 +fish_color_cwd 00ff00 +fish_color_cwd_root 00cd00 +fish_color_end 00ff00 +fish_color_error ff0000 +fish_color_escape 00ffff +fish_color_history_current --bold +fish_color_host ffffff +fish_color_host_remote cdcd00 +fish_color_keyword 5c5cff +fish_color_operator 00ffff +fish_color_option 00cdcd +fish_color_param 00cdcd +fish_color_quote cdcd00 +fish_color_redirection 00cdcd --bold +fish_color_search_match ffffff --bold --background=7f7f7f +fish_color_selection ffffff --bold --background=7f7f7f +fish_color_status 00cd00 +fish_color_user 00ff00 +fish_color_valid_path --underline +fish_pager_color_description cdcd00 --italics +fish_pager_color_prefix ffffff --bold --underline +fish_pager_color_progress ffffff --background=00cdcd --bold +fish_pager_color_selected_background --background=7f7f7f +fish_pager_color_selected_prefix ffffff --bold +fish_pager_color_selected_completion ffffff --bold +fish_pager_color_selected_description ffffff --bold --italics diff --git a/share/tools/web_config/themes/default-light.theme b/share/tools/web_config/themes/default-light.theme new file mode 100644 index 000000000..2570f47bb --- /dev/null +++ b/share/tools/web_config/themes/default-light.theme @@ -0,0 +1,34 @@ +# name: fish default (light mode) +# preferred_background: ffffff + +fish_color_normal 000000 +fish_color_autosuggestion 7f7f7f +fish_color_cancel ffffff --background=000000 +fish_color_command 0000ee +fish_color_comment cd0000 +fish_color_cwd 00cd00 +fish_color_cwd_root cd0000 +fish_color_end 00cd00 +fish_color_error ff0000 +fish_color_escape 00cdcd +fish_color_history_current --bold +fish_color_host 000000 +fish_color_host_remote a0a000 +fish_color_keyword 0000ee +fish_color_operator 00cdcd +fish_color_option 00a0a0 +fish_color_param 00a0a0 +fish_color_quote a0a000 +fish_color_redirection 00a0a0 --bold +fish_color_search_match 060606 --bold --background=cdcdcd +fish_color_selection 060606 --bold --background=cdcdcd +fish_color_status cd0000 +fish_color_user 00cd00 +fish_color_valid_path --underline +fish_pager_color_description a0a000 --italics +fish_pager_color_prefix 000000 --bold --underline +fish_pager_color_progress ffffff --background=00a0a0 --bold +fish_pager_color_selected_background --background=cdcdcd +fish_pager_color_selected_prefix 060606 --bold +fish_pager_color_selected_completion 060606 --bold +fish_pager_color_selected_description 060606 --bold --italics diff --git a/tests/checks/fish_config.fish b/tests/checks/fish_config.fish index 95d2f36b8..2afca77ee 100644 --- a/tests/checks/fish_config.fish +++ b/tests/checks/fish_config.fish @@ -148,9 +148,11 @@ fish_config theme show ayu-dark ayu-light | string match -r '^.*ayu.*' mkdir $__fish_config_dir/themes touch $__fish_config_dir/themes/custom-from-userconf.theme -fish_config theme show | grep -E '[^-]default|default-dark|custom-from-userconf' +fish_config theme show | grep -E '[^-]default|base16-default-dark|custom-from-userconf' # CHECK: {{.*}}custom-from-userconf{{\x1b\[m}} # CHECK: {{.*}}base16-default-dark{{\x1b\[m}} +# CHECK: {{.*}}default-dark{{\x1b\[m}} +# CHECK: {{.*}}default-light{{\x1b\[m}} # CHECK: {{.*}}default{{\x1b\[m}} # Override a default theme with different colors. @@ -162,6 +164,12 @@ fish_config theme show | grep -E '[^-]default|base16-default-dark' -A1 # CHECK: -- # CHECK: {{\x1b\[m}}{{\x1b\[4m}}base16-default-dark{{\x1b\[m}} # CHECK: {{.*}}/bright/vixens{{.*}} +# CHECK: -- +# CHECK: {{\x1b\[m}}{{\x1b\[4m}}default-dark{{\x1b\[m}} +# CHECK: {{.*}}/bright/vixens{{.*}} +# CHECK: -- +# CHECK: {{\x1b\[m}}{{\x1b\[4m}}default-light{{\x1b\[m}} +# CHECK: {{.*}}/bright/vixens{{.*}} function print-sample-colors echo "normal=$fish_color_normal"