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
@@ -1,193 +0,0 @@
#!/usr/bin/env fish
# tinted-shell (https://github.com/tinted-theming/tinted-shell)
# Scheme name: ReThink
# Scheme author: fe5hua
# Template author: Tinted Theming (https://github.com/tinted-theming)
set -l color00 "f4/f4/f4" # Base 00 - Black
set -l color01 "da/1e/28" # Base 08 - Red
set -l color02 "24/a1/48" # Base 0B - Green
set -l color03 "f1/c2/1b" # Base 0A - Yellow
set -l color04 "00/72/c3" # Base 0D - Blue
set -l color05 "8a/3f/fc" # Base 0E - Magenta
set -l color06 "00/9d/9a" # Base 0C - Cyan
set -l color07 "26/26/26" # Base 05 - White
set -l color08 "8d/8d/8d" # Base 03 - Bright Black
set -l color09 "fa/4d/56" # Base 12 - Bright Red
set -l color10 "6f/dc/8c" # Base 14 - Bright Green
set -l color11 "f9/d3/4a" # Base 13 - Bright Yellow
set -l color12 "33/b1/ff" # Base 16 - Bright Blue
set -l color13 "a5/6e/ff" # Base 17 - Bright Magenta
set -l color14 "3d/db/d9" # Base 15 - Bright Cyan
set -l color15 "00/00/00" # Base 07 - Bright White
set -l color16 "ff/83/2b" # Base 09
set -l color17 "a2/19/1f" # Base 0F
set -l color18 "e0/e0/e0" # Base 01
set -l color19 "c6/c6/c6" # Base 02
set -l color20 "52/52/52" # Base 04
set -l color21 "16/16/16" # Base 06
set -l color_foreground "26/26/26" # Base 05
set -l color_background "f4/f4/f4" # 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 262626 # foreground
put_template_custom Ph f4f4f4 # background
put_template_custom Pi 262626 # bold color
put_template_custom Pj c6c6c6 # selection color
put_template_custom Pk 262626 # selected text color
put_template_custom Pl 262626 # cursor
put_template_custom Pm f4f4f4 # 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 8d8d8d
set -U fish_color_selection 161616 --background=c6c6c6
set -U fish_color_operator magenta
set -U fish_color_escape ff832b
set -U fish_color_autosuggestion 8d8d8d
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=c6c6c6
set -U fish_color_history_current --underline=curly
set -U fish_pager_color_progress e0e0e0 --background=525252
set -U fish_pager_color_background --background=f4f4f4
set -U fish_pager_color_prefix --bold --italics
set -U fish_pager_color_completion normal
set -U fish_pager_color_description ff832b
set -U fish_pager_color_selected_background --background=c6c6c6
set -U fish_pager_color_selected_prefix --bold --italics --background=c6c6c6
set -U fish_pager_color_selected_completion normal
set -U fish_pager_color_description ff832b
# 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 re-think
# Optionally export variables
if test -n "$TINTED_SHELL_ENABLE_BASE24_VARS"; or test -n "$BASE24_SHELL_ENABLE_VARS"
set -gx BASE24_COLOR_00_HEX "f4f4f4"
set -gx BASE24_COLOR_01_HEX "e0e0e0"
set -gx BASE24_COLOR_02_HEX "c6c6c6"
set -gx BASE24_COLOR_03_HEX "8d8d8d"
set -gx BASE24_COLOR_04_HEX "525252"
set -gx BASE24_COLOR_05_HEX "262626"
set -gx BASE24_COLOR_06_HEX "161616"
set -gx BASE24_COLOR_07_HEX "000000"
set -gx BASE24_COLOR_08_HEX "da1e28"
set -gx BASE24_COLOR_09_HEX "ff832b"
set -gx BASE24_COLOR_0A_HEX "f1c21b"
set -gx BASE24_COLOR_0B_HEX "24a148"
set -gx BASE24_COLOR_0C_HEX "009d9a"
set -gx BASE24_COLOR_0D_HEX "0072c3"
set -gx BASE24_COLOR_0E_HEX "8a3ffc"
set -gx BASE24_COLOR_0F_HEX "a2191f"
end
@@ -0,0 +1,196 @@
#!/usr/bin/env fish
# tinted-shell (https://github.com/tinted-theming/tinted-shell)
# Scheme name: {{ if eq .mode "dark" }}{{ .theme.dark.name }}{{ else }}{{ .theme.light.name }}{{ end }}
# Scheme author: {{ if eq .mode "dark" }}{{ .theme.dark.author }}{{ else }}{{ .theme.light.author }}{{ end }}
# Template author: Tinted Theming (https://github.com/tinted-theming)
{{- $theme := .theme.light -}}
{{- if eq .mode "dark" }}{{ $theme = .theme.dark }}{{ end -}}
{{- define "rgb" -}}{{ . | replaceAllRegex "([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})" "$1/$2/$3" }}{{- end }}
set -l color00 "{{ template "rgb" $theme.palette.base00 }}" # Base 00 - Black
set -l color01 "{{ template "rgb" $theme.palette.base08 }}" # Base 08 - Red
set -l color02 "{{ template "rgb" $theme.palette.base0B }}" # Base 0B - Green
set -l color03 "{{ template "rgb" $theme.palette.base0A }}" # Base 0A - Yellow
set -l color04 "{{ template "rgb" $theme.palette.base0D }}" # Base 0D - Blue
set -l color05 "{{ template "rgb" $theme.palette.base0E }}" # Base 0E - Magenta
set -l color06 "{{ template "rgb" $theme.palette.base0C }}" # Base 0C - Cyan
set -l color07 "{{ template "rgb" $theme.palette.base05 }}" # Base 05 - White
set -l color08 "{{ template "rgb" $theme.palette.base03 }}" # Base 03 - Bright Black
set -l color09 "{{ template "rgb" $theme.palette.base12 }}" # Base 12 - Bright Red
set -l color10 "{{ template "rgb" $theme.palette.base14 }}" # Base 14 - Bright Green
set -l color11 "{{ template "rgb" $theme.palette.base13 }}" # Base 13 - Bright Yellow
set -l color12 "{{ template "rgb" $theme.palette.base16 }}" # Base 16 - Bright Blue
set -l color13 "{{ template "rgb" $theme.palette.base17 }}" # Base 17 - Bright Magenta
set -l color14 "{{ template "rgb" $theme.palette.base15 }}" # Base 15 - Bright Cyan
set -l color15 "{{ template "rgb" $theme.palette.base07 }}" # Base 07 - Bright White
set -l color16 "{{ template "rgb" $theme.palette.base09 }}" # Base 09
set -l color17 "{{ template "rgb" $theme.palette.base0F }}" # Base 0F
set -l color18 "{{ template "rgb" $theme.palette.base01 }}" # Base 01
set -l color19 "{{ template "rgb" $theme.palette.base02 }}" # Base 02
set -l color20 "{{ template "rgb" $theme.palette.base04 }}" # Base 04
set -l color21 "{{ template "rgb" $theme.palette.base06 }}" # Base 06
set -l color_foreground "{{ template "rgb" $theme.palette.base05 }}" # Base 05
set -l color_background "{{ template "rgb" $theme.palette.base00 }}" # 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 {{ $theme.palette.base05 }} # foreground
put_template_custom Ph {{ $theme.palette.base00 }} # background
put_template_custom Pi {{ $theme.palette.base05 }} # bold color
put_template_custom Pj {{ $theme.palette.base02 }} # selection color
put_template_custom Pk {{ $theme.palette.base05 }} # selected text color
put_template_custom Pl {{ $theme.palette.base05 }} # cursor
put_template_custom Pm {{ $theme.palette.base00 }} # 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 {{ $theme.palette.base03 }}
set -U fish_color_selection {{ $theme.palette.base06 }} --background={{ $theme.palette.base02 }}
set -U fish_color_operator magenta
set -U fish_color_escape {{ $theme.palette.base09 }}
set -U fish_color_autosuggestion {{ $theme.palette.base03 }}
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={{ $theme.palette.base02 }}
set -U fish_color_history_current --underline=curly
set -U fish_pager_color_progress {{ $theme.palette.base01 }} --background={{ $theme.palette.base04 }}
set -U fish_pager_color_background --background={{ $theme.palette.base00 }}
set -U fish_pager_color_prefix --bold --italics
set -U fish_pager_color_completion normal
set -U fish_pager_color_description {{ $theme.palette.base09 }}
set -U fish_pager_color_selected_background --background={{ $theme.palette.base02 }}
set -U fish_pager_color_selected_prefix --bold --italics --background={{ $theme.palette.base02 }}
set -U fish_pager_color_selected_completion normal
set -U fish_pager_color_description {{ $theme.palette.base09 }}
# 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 {{ $theme.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 "{{ $theme.palette.base00 }}"
set -gx BASE24_COLOR_01_HEX "{{ $theme.palette.base01 }}"
set -gx BASE24_COLOR_02_HEX "{{ $theme.palette.base02 }}"
set -gx BASE24_COLOR_03_HEX "{{ $theme.palette.base03 }}"
set -gx BASE24_COLOR_04_HEX "{{ $theme.palette.base04 }}"
set -gx BASE24_COLOR_05_HEX "{{ $theme.palette.base05 }}"
set -gx BASE24_COLOR_06_HEX "{{ $theme.palette.base06 }}"
set -gx BASE24_COLOR_07_HEX "{{ $theme.palette.base07 }}"
set -gx BASE24_COLOR_08_HEX "{{ $theme.palette.base08 }}"
set -gx BASE24_COLOR_09_HEX "{{ $theme.palette.base09 }}"
set -gx BASE24_COLOR_0A_HEX "{{ $theme.palette.base0A }}"
set -gx BASE24_COLOR_0B_HEX "{{ $theme.palette.base0B }}"
set -gx BASE24_COLOR_0C_HEX "{{ $theme.palette.base0C }}"
set -gx BASE24_COLOR_0D_HEX "{{ $theme.palette.base0D }}"
set -gx BASE24_COLOR_0E_HEX "{{ $theme.palette.base0E }}"
set -gx BASE24_COLOR_0F_HEX "{{ $theme.palette.base0F }}"
end
+3
View File
@@ -5,6 +5,9 @@ if status is-interactive
end
end
# PATH
fish_add_path -g ~/.local/bin
# system defaults
set -x EDITOR vim