bash: factor out solarized into separate script

This commit is contained in:
Fernando Schauenburg 2020-12-26 02:37:50 +01:00
parent 2859cbf949
commit 75b6b3a2dc
2 changed files with 30 additions and 13 deletions

View file

@ -377,21 +377,8 @@ tree() { command tree --dirsfirst -FI '.git|Spotlight-V100|.fseventsd' "$@"; }
ltree() { tree -C "$@" | less -R; }
# Combined mkdir and cd
mkcd() { mkdir -p -- "$1" && cd -P -- "$1" || return; }
solarized() {
local name rgb _bg n
for name in \
Red Orange Yellow Green Cyan Blue Violet Magenta \
Base{0{3..0},{0..3}}
do
rgb=${name}_RGB _bg=${name}_BG n=${name}_N
printf "${!_bg}%6s$Reset ${!name}#${!rgb} %2s $name$Reset\n" '' "${!n}"
done
}
##############################################################################
# Run external customizations
##############################################################################

View file

@ -0,0 +1,30 @@
#!/bin/sh
print_color() {
printf '%s%6s%s %s#%s %2s %s%s\n' "$(tput setab "$3")" \
'' \
"$(tput sgr0)" \
"$(tput setaf "$3")" \
"$2" \
"$3" \
"$1" \
"$(tput sgr0)"
}
print_color Base03 "002B36" 8
print_color Base02 "073642" 0
print_color Base01 "586E75" 10
print_color Base00 "657B83" 11
print_color Base0 "839496" 12
print_color Base1 "93A1A1" 14
print_color Base2 "EEE8D5" 7
print_color Base3 "FDF6E3" 15
print_color Red "DC322F" 1
print_color Orange "CB4B16" 9
print_color Yellow "B58900" 3
print_color Green "859900" 2
print_color Cyan "2AA198" 6
print_color Blue "268BD2" 4
print_color Violet "6C71C4" 13
print_color Magenta "D33682" 5