Adds a colortest-truecolor function to config

This commit is contained in:
2022-01-19 12:01:56 +01:00
parent 44673a79b8
commit 75c5f03e97

View File

@@ -1,5 +1,3 @@
# -*- mode: shell-scrip -*-
set fish_greeting "" set fish_greeting ""
################################################################################ ################################################################################
@@ -40,9 +38,17 @@ if test -x /usr/local/go/bin/go
set PATH $PATH $GOROOT/bin $GOPATH/bin set PATH $PATH $GOROOT/bin $GOPATH/bin
end end
################################################################################
# Minicon
################################################################################
export MINICOM="-c on" export MINICOM="-c on"
################################################################################
# Conda
################################################################################
if test -x $HOME/miniconda3/bin/conda if test -x $HOME/miniconda3/bin/conda
# >>> conda initialize >>> # >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !! # !! Contents within this block are managed by 'conda init' !!
@@ -56,10 +62,35 @@ end
direnv hook fish | source direnv hook fish | source
################################################################################ ################################################################################
# Starship # Starship
################################################################################ ################################################################################
starship init fish | source starship init fish | source
################################################################################
# Colortest
################################################################################
function colortest-truecolors
for colnum in (seq 0 76)
set r (math round\(255 -\( $colnum \* 255 / 76\)\))
set g (math round\($colnum \* 510 / 76\))
set b (math round\($colnum \* 255 / 76\))
if test $g -gt 255
set g (math 510 - $g)
end
echo -en "\033[48;2;$r;$g;"$b"m"
set r (math 255 - $r)
set g (math 255 -$g)
set b (math 255 - $b)
echo -en "\033[38;2;$r;$g;"$b"m"
if test (math $colnum % 2) -eq 1
echo -n "\\"
else
echo -n "/"
end
echo -en "\033[0m"
end
echo ""
end