prcolors: major bug fixes and formatting, and zsh is now the shell (fixes option 3)

This commit is contained in:
PowerUser64 2022-02-06 22:14:44 -08:00
parent da5d2d9597
commit 4dd6db0386

View file

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/zsh
# prcolors: Display all colors in a few different ways >>> # prcolors: Display all colors in a few different ways >>>
# TODO: change this to make it not just a few scripts smashed together # TODO: change this to make it not just a few scripts smashed together
[ -z "$1" ] && 1=0 if [ "$1" -gt 0 ] && [ "$1" -lt 4 ]; then
if [ $1 -eq '1' ];then if [ $1 = '1' ];then
# Taken from manjaro's bashrc >>> # Taken from manjaro's bashrc >>>
local fgc bgc vals seq0 local fgc bgc vals seq0
@ -31,7 +31,7 @@ if [ $1 -eq '1' ];then
echo; echo echo; echo
done done
# <<< # <<<
elif [ $1 -eq '2' ];then elif [ $1 = '2' ];then
# from base16shell >>> # from base16shell >>>
ansi_mappings=( ansi_mappings=(
Red Green Red Green
@ -72,13 +72,12 @@ elif [ $1 -eq '2' ];then
# printf "To restore current theme, source ~/.base16_theme or reopen your terminal\n" # printf "To restore current theme, source ~/.base16_theme or reopen your terminal\n"
#fi #fi
# <<< # <<<
elif [ $1 -eq '3' ];then elif [ $1 = '3' ];then
# Similar to above, but does 256-bit colors. >>> # Similar to above, but does 256-bit colors. >>>
# Taken from this: https://github.com/romkatv/powerlevel10k#set-colors-through-Powerlevel10k-configuration-parameters # Taken from this: https://github.com/romkatv/powerlevel10k#set-colors-through-Powerlevel10k-configuration-parameters
for i in {0..255}; do for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done
print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}
done
# <<< # <<<
fi
else else
cat <<-EOF cat <<-EOF
Usage: prcolors <printing method number> Usage: prcolors <printing method number>
@ -88,3 +87,4 @@ else
EOF EOF
fi fi
# vim:foldmarker=>>>,<<< fdm=marker foldlevel=1