changing to templates for theme (alacritty and fish)

This commit is contained in:
2026-09-13 11:08:54 +02:00
parent 410297fa21
commit 6698279acd
16 changed files with 1156 additions and 179 deletions
+193
View File
@@ -0,0 +1,193 @@
#!/usr/bin/env fish
# tinted-shell (https://github.com/tinted-theming/tinted-shell)
# Scheme name: {{scheme-name}}
# Scheme author: {{scheme-author}}
# Template author: Tinted Theming (https://github.com/tinted-theming)
set -l color00 "{{base00-hex-r}}/{{base00-hex-g}}/{{base00-hex-b}}" # Base 00 - Black
set -l color01 "{{base08-hex-r}}/{{base08-hex-g}}/{{base08-hex-b}}" # Base 08 - Red
set -l color02 "{{base0B-hex-r}}/{{base0B-hex-g}}/{{base0B-hex-b}}" # Base 0B - Green
set -l color03 "{{base0A-hex-r}}/{{base0A-hex-g}}/{{base0A-hex-b}}" # Base 0A - Yellow
set -l color04 "{{base0D-hex-r}}/{{base0D-hex-g}}/{{base0D-hex-b}}" # Base 0D - Blue
set -l color05 "{{base0E-hex-r}}/{{base0E-hex-g}}/{{base0E-hex-b}}" # Base 0E - Magenta
set -l color06 "{{base0C-hex-r}}/{{base0C-hex-g}}/{{base0C-hex-b}}" # Base 0C - Cyan
set -l color07 "{{base05-hex-r}}/{{base05-hex-g}}/{{base05-hex-b}}" # Base 05 - White
set -l color08 "{{base03-hex-r}}/{{base03-hex-g}}/{{base03-hex-b}}" # Base 03 - Bright Black
set -l color09 "{{base12-hex-r}}/{{base12-hex-g}}/{{base12-hex-b}}" # Base 12 - Bright Red
set -l color10 "{{base14-hex-r}}/{{base14-hex-g}}/{{base14-hex-b}}" # Base 14 - Bright Green
set -l color11 "{{base13-hex-r}}/{{base13-hex-g}}/{{base13-hex-b}}" # Base 13 - Bright Yellow
set -l color12 "{{base16-hex-r}}/{{base16-hex-g}}/{{base16-hex-b}}" # Base 16 - Bright Blue
set -l color13 "{{base17-hex-r}}/{{base17-hex-g}}/{{base17-hex-b}}" # Base 17 - Bright Magenta
set -l color14 "{{base15-hex-r}}/{{base15-hex-g}}/{{base15-hex-b}}" # Base 15 - Bright Cyan
set -l color15 "{{base07-hex-r}}/{{base07-hex-g}}/{{base07-hex-b}}" # Base 07 - Bright White
set -l color16 "{{base09-hex-r}}/{{base09-hex-g}}/{{base09-hex-b}}" # Base 09
set -l color17 "{{base0F-hex-r}}/{{base0F-hex-g}}/{{base0F-hex-b}}" # Base 0F
set -l color18 "{{base01-hex-r}}/{{base01-hex-g}}/{{base01-hex-b}}" # Base 01
set -l color19 "{{base02-hex-r}}/{{base02-hex-g}}/{{base02-hex-b}}" # Base 02
set -l color20 "{{base04-hex-r}}/{{base04-hex-g}}/{{base04-hex-b}}" # Base 04
set -l color21 "{{base06-hex-r}}/{{base06-hex-g}}/{{base06-hex-b}}" # Base 06
set -l color_foreground "{{base05-hex-r}}/{{base05-hex-g}}/{{base05-hex-b}}" # Base 05
set -l color_background "{{base00-hex-r}}/{{base00-hex-g}}/{{base00-hex-b}}" # Base 00
if test -z "$TTY"
set -gx TTY (tty)
end
if test -z "$TTY"; or not test -w "$TTY"
function put_template; true; end
function put_template_var; true; end
function put_template_custom; true; end
else if set -q TMUX; or string match -q 'tmux*' $TERM
# Tell tmux to pass the escape sequences through
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324)
function put_template; printf '\033Ptmux;\033\033]4;%d;rgb:%s\033\033\\\033\\' $argv > "$TTY"; end
function put_template_var; printf '\033Ptmux;\033\033]%d;rgb:%s\033\033\\\033\\' $argv > "$TTY"; end
function put_template_custom; printf '\033Ptmux;\033\033]%s%s\033\033\\\033\\' $argv > "$TTY"; end
else if string match -q 'screen*' $TERM
# GNU screen (screen, screen-256color, screen-256color-bce)
function put_template; printf '\033P\033]4;%d;rgb:%s\007\033\\' $argv > "$TTY"; end
function put_template_var; printf '\033P\033]%d;rgb:%s\007\033\\' $argv > "$TTY"; end
function put_template_custom; printf '\033P\033]%s%s\007\033\\' $argv > "$TTY"; end
else if string match -q 'linux*' $TERM
function put_template; test $argv[1] -lt 16 && printf "\e]P%x%s" $argv[1] (echo $argv[2] | sed 's/\///g') > "$TTY"; end
function put_template_var; true; end
function put_template_custom; true; end
else
function put_template; printf '\033]4;%d;rgb:%s\033\\' $argv > "$TTY"; end
function put_template_var; printf '\033]%d;rgb:%s\033\\' $argv > "$TTY"; end
function put_template_custom; printf '\033]%s%s\033\\' $argv > "$TTY"; end
end
# 16 color space
put_template 0 $color00
put_template 1 $color01
put_template 2 $color02
put_template 3 $color03
put_template 4 $color04
put_template 5 $color05
put_template 6 $color06
put_template 7 $color07
put_template 8 $color08
put_template 9 $color09
put_template 10 $color10
put_template 11 $color11
put_template 12 $color12
put_template 13 $color13
put_template 14 $color14
put_template 15 $color15
# 256 color space
put_template 16 $color16
put_template 17 $color17
put_template 18 $color18
put_template 19 $color19
put_template 20 $color20
put_template 21 $color21
# foreground / background / cursor color
if test -n "$ITERM_SESSION_ID"
put_template_custom Pg {{base05-hex}} # foreground
put_template_custom Ph {{base00-hex}} # background
put_template_custom Pi {{base05-hex}} # bold color
put_template_custom Pj {{base02-hex}} # selection color
put_template_custom Pk {{base05-hex}} # selected text color
put_template_custom Pl {{base05-hex}} # cursor
put_template_custom Pm {{base00-hex}} # cursor text
else
put_template_var 10 $color_foreground
if test "$BASE24_SHELL_SET_BACKGROUND" != false
put_template_var 11 $color_background
if string match -q 'rxvt*' $TERM
put_template_var 708 $color_background # internal border (rxvt)
end
end
put_template_custom 12 ";7" # cursor (reverse video)
end
set -U fish_color_normal normal
set -U fish_color_command blue
set -U fish_color_keyword magenta
set -U fish_color_quote green
set -U fish_color_redirection brblue
set -U fish_color_end normal
set -U fish_color_error brred
set -U fish_color_param brcyan
set -U fish_color_valid_path --underline
set -U fish_color_option brcyan --italics
set -U fish_color_comment {{base03-hex}}
set -U fish_color_selection {{base06-hex}} --background={{base02-hex}}
set -U fish_color_operator magenta
set -U fish_color_escape {{base09-hex}}
set -U fish_color_autosuggestion {{base03-hex}}
set -U fish_color_cwd green
set -U fish_color_cwd_root red
set -U fish_color_user brgreen
set -U fish_color_host normal
set -U fish_color_host_remote normal
set -U fish_color_status red
set -U fish_color_cancel -r
set -U fish_color_search_match yellow --background={{base02-hex}}
set -U fish_color_history_current --underline=curly
set -U fish_pager_color_progress {{base01-hex}} --background={{base04-hex}}
set -U fish_pager_color_background --background={{base00-hex}}
set -U fish_pager_color_prefix --bold --italics
set -U fish_pager_color_completion normal
set -U fish_pager_color_description {{base09-hex}}
set -U fish_pager_color_selected_background --background={{base02-hex}}
set -U fish_pager_color_selected_prefix --bold --italics --background={{base02-hex}}
set -U fish_pager_color_selected_completion normal
set -U fish_pager_color_description {{base09-hex}}
# clean up
set -e color00
set -e color01
set -e color02
set -e color03
set -e color04
set -e color05
set -e color06
set -e color07
set -e color08
set -e color09
set -e color10
set -e color11
set -e color12
set -e color13
set -e color14
set -e color15
set -e color16
set -e color17
set -e color18
set -e color19
set -e color20
set -e color21
set -e color_foreground
set -e color_background
functions -e put_template put_template_var put_template_custom
set -l legacy_env (string match -r '^(BASE16|BASE24|TINTED8)_(THEME|COLOR_).*' (set -xn))
test -n "$legacy_env"; and set -e $legacy_env
set -l legacy_env (string match -r '^(BASE16|BASE24|TINTED8)_THEME' (set -Uxn))
test -n "$legacy_env"; and set -Ue $legacy_env
set -e legacy_env
# Set theme
set -Ux BASE24_THEME {{scheme-slug}}
# Optionally export variables
if test -n "$TINTED_SHELL_ENABLE_BASE24_VARS"; or test -n "$BASE24_SHELL_ENABLE_VARS"
set -gx BASE24_COLOR_00_HEX "{{base00-hex}}"
set -gx BASE24_COLOR_01_HEX "{{base01-hex}}"
set -gx BASE24_COLOR_02_HEX "{{base02-hex}}"
set -gx BASE24_COLOR_03_HEX "{{base03-hex}}"
set -gx BASE24_COLOR_04_HEX "{{base04-hex}}"
set -gx BASE24_COLOR_05_HEX "{{base05-hex}}"
set -gx BASE24_COLOR_06_HEX "{{base06-hex}}"
set -gx BASE24_COLOR_07_HEX "{{base07-hex}}"
set -gx BASE24_COLOR_08_HEX "{{base08-hex}}"
set -gx BASE24_COLOR_09_HEX "{{base09-hex}}"
set -gx BASE24_COLOR_0A_HEX "{{base0A-hex}}"
set -gx BASE24_COLOR_0B_HEX "{{base0B-hex}}"
set -gx BASE24_COLOR_0C_HEX "{{base0C-hex}}"
set -gx BASE24_COLOR_0D_HEX "{{base0D-hex}}"
set -gx BASE24_COLOR_0E_HEX "{{base0E-hex}}"
set -gx BASE24_COLOR_0F_HEX "{{base0F-hex}}"
end