reuse RGB definitions in solarized function

This commit is contained in:
Fernando Schauenburg 2019-02-27 19:49:14 +01:00
parent 55af22587e
commit 60cc636729

View file

@ -259,14 +259,12 @@ bashrc_customize_ls() {
solarized() {
local names=(Base02 Red Green Yellow Blue Magenta Cyan Base2
Base03 Orange Base01 Base00 Base0 Violet Base1 Base3)
local hex=(073642 DC322F 859900 B58900 268BD2 D33682 2AA198 EEE8D5
002B36 CB4B16 586E75 657B83 839496 6C71C4 93A1A1 FDF6E3)
for index in 1 9 3 2 6 4 13 5 8 0 10 11 12 14 7 15; do
local c="$(( $index > 7 ));$(( 30 + $index % 8 ))"
printf \
"\033[${c}m%2d $c ${hex[index]} %-7s \x1b[48;5;${index}m%s\033[0m\n" \
$index ${names[index]} " "
for i in 1 9 3 2 6 4 13 5 8 0 10 11 12 14 7 15; do
local name=${names[i]}
local name_rgb=${name}_RGB
local code=${!name} rgb=${!name_rgb}
echo -e "\x1b[48;5;${i}m \033[0m \033[${code}m#$rgb $code $name ($i)"
done
}