akinomyoga / ble.sh

Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions.
BSD 3-Clause "New" or "Revised" License
2.32k stars 77 forks source link

Easy way to adopt fish colours? #344

Open haizaar opened 12 months ago

haizaar commented 12 months ago

Fish has an amazing web UI where I can set its prompt/completion colors. I like pastel theme which generates the following variables and I wonder how can I convert to ble.sh configuration. Any ideas/docos?

# Colorscheme: Base16 Eighties
set -U fish_color_normal normal  
set -U fish_color_command 99cc99  
set -U fish_color_quote ffcc66  
set -U fish_color_redirection d3d0c8  
set -U fish_color_end cc99cc  
set -U fish_color_error f2777a  
set -U fish_color_param d3d0c8  
set -U fish_color_comment ffcc66  
set -U fish_color_match 6699cc  
set -U fish_color_selection white --bold --background=brblack  
set -U fish_color_search_match bryellow --background=brblack  
set -U fish_color_history_current --bold  
set -U fish_color_operator 6699cc  
set -U fish_color_escape 66cccc  
set -U fish_color_cwd green  
set -U fish_color_cwd_root red  
set -U fish_color_valid_path --underline  
set -U fish_color_autosuggestion 747369  
set -U fish_color_user brgreen  
set -U fish_color_host normal  
set -U fish_color_cancel --reverse  
set -U fish_pager_color_prefix normal --bold --underline  
set -U fish_pager_color_progress brwhite --background=cyan  
set -U fish_pager_color_completion normal  
set -U fish_pager_color_description B3A06D  
set -U fish_pager_color_selected_background --background=brblack  
set -U fish_pager_color_selected_description   
set -U fish_pager_color_secondary_background   
set -U fish_color_host_remote   
set -U fish_pager_color_background   
set -U fish_color_keyword   
set -U fish_color_option   
set -U fish_pager_color_secondary_completion   
set -U fish_pager_color_secondary_description   
set -U fish_pager_color_secondary_prefix   
set -U fish_pager_color_selected_prefix   
set -U fish_pager_color_selected_completion  
akinomyoga commented 12 months ago

I wonder how can I convert to ble.sh configuration. Any ideas/docos?

Of course, you can manually convert the configuration one by one and apply it to the corresponding faces of ble.sh. The list of faces is provided in README §2.6. The detailed way of specifying the colors and styles are described in Manual §2.1.

There is currently no automated conversion from the fish spec to the ble.sh spec. I think one of the problems in automating the conversion is that there is no one-to-one correspondence between fish specifications and ble.sh faces, so the desired correspondence can depend on the personal preferences of each user. Also, ble.sh has a larger number of faces, i.e., more detailed distinctions of the syntax components and the contexts, so simply applying the setting of the closest one to a ble.sh's face would degenerate the detailed distinction by ble.sh. Maybe it is still useful to have a converter for the users who do not care about it so much.

Another way to automatically "generate a color theme" might be to use the contrib/colorglass module. This module allows a user to adjust existing color settings all at once by changing the hue, gamma, color mixing, etc. You might adjust these parameters to make the overall impression "similar (but not the same)" to the existing fish theme.

akinomyoga commented 11 months ago

I searched for some materials to understand the fish color schemes. We can find the bundled color schemes of fish in the directory /share/tools/web_config/themes [1] of the source repository. The manual of set builtin is found in Ref. [2], but it seems the theme files omit set -U provided in the cover of this Issue. Also, it is not documented there how to specify the options like --background, --bold, --underline. The corresponding source codes that parse these options seem to be found at Ref. [3]. I instead found another documentation page that seems to describe these options [4].