Scripts: fix colo.sh bug
This commit is contained in:
parent
034231e223
commit
620be2c4dd
1 changed files with 12 additions and 11 deletions
23
bin/colo.sh
23
bin/colo.sh
|
@ -30,7 +30,7 @@ Example:
|
||||||
colo.sh gruvboxdark
|
colo.sh gruvboxdark
|
||||||
colo.sh --colorscheme
|
colo.sh --colorscheme
|
||||||
|
|
||||||
$(__print_current_colors)
|
$(print_current_colors)
|
||||||
HELP
|
HELP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ query_color_scheme() {
|
||||||
}
|
}
|
||||||
|
|
||||||
query_color_tone() {
|
query_color_tone() {
|
||||||
case "$COLOR_SCHEME" in
|
case "$(query_color_scheme)" in
|
||||||
base16-gruvbox-dark-pale) echo 'dark' ;;
|
base16-gruvbox-dark-pale) echo 'dark' ;;
|
||||||
base16-gruvbox-light-hard) echo 'light' ;;
|
base16-gruvbox-light-hard) echo 'light' ;;
|
||||||
base16-dracula) echo 'dark' ;;
|
base16-dracula) echo 'dark' ;;
|
||||||
|
@ -59,8 +59,8 @@ print_current_colors() {
|
||||||
|
|
||||||
# Updates the color scheme for alacritty. Best with alacritty's live reload
|
# Updates the color scheme for alacritty. Best with alacritty's live reload
|
||||||
change_alacritty_colors() {
|
change_alacritty_colors() {
|
||||||
local to_color="$1"
|
local -r to_color="$1"
|
||||||
local conf_file="$2"
|
local -r conf_file="$2"
|
||||||
|
|
||||||
local tmp="$(mktemp)"
|
local tmp="$(mktemp)"
|
||||||
awk \
|
awk \
|
||||||
|
@ -83,8 +83,8 @@ change_alacritty_colors() {
|
||||||
}
|
}
|
||||||
|
|
||||||
change_vimiv_colors() {
|
change_vimiv_colors() {
|
||||||
local to_color="$1"
|
local -r to_color="$1"
|
||||||
local conf_file="$2"
|
local -r conf_file="$2"
|
||||||
|
|
||||||
local tmp="$(mktemp)"
|
local tmp="$(mktemp)"
|
||||||
awk -v c="$to_color" '/^\s*style = /{ $3=c } 1' "$conf_file" > "$tmp"
|
awk -v c="$to_color" '/^\s*style = /{ $3=c } 1' "$conf_file" > "$tmp"
|
||||||
|
@ -93,7 +93,8 @@ change_vimiv_colors() {
|
||||||
|
|
||||||
# Changes the colors and sets environment variables
|
# Changes the colors and sets environment variables
|
||||||
change_color_scheme() {
|
change_color_scheme() {
|
||||||
local to_color="$1"
|
local -r to_color="$1"
|
||||||
|
|
||||||
change_alacritty_colors "$to_color" "$ALACRITTY_CONF"
|
change_alacritty_colors "$to_color" "$ALACRITTY_CONF"
|
||||||
change_vimiv_colors "$to_color" "$VIMIV_CONF"
|
change_vimiv_colors "$to_color" "$VIMIV_CONF"
|
||||||
print_current_colors
|
print_current_colors
|
||||||
|
@ -107,10 +108,10 @@ declare -r ALACRITTY_CONF=~/.config/alacritty/alacritty.toml
|
||||||
declare -r VIMIV_CONF=~/.config/vimiv/vimiv.conf
|
declare -r VIMIV_CONF=~/.config/vimiv/vimiv.conf
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-t | --tone) __query_color_tone ;;
|
-t | --tone) query_color_tone ;;
|
||||||
-c | --colorscheme) echo "$COLOR_SCHEME" ;;
|
-c | --colorscheme) echo "$(query_color_scheme)" ;;
|
||||||
-q | --query) __print_current_colors ;;
|
-q | --query) print_current_colors ;;
|
||||||
-h | --help) __print_color_help ;;
|
-h | --help) print_color_help ;;
|
||||||
light | gruvboxlight) change_color_scheme "base16-gruvbox-light-hard" ;;
|
light | gruvboxlight) change_color_scheme "base16-gruvbox-light-hard" ;;
|
||||||
dracula) change_color_scheme "base16-dracula" ;;
|
dracula) change_color_scheme "base16-dracula" ;;
|
||||||
github) change_color_scheme "base16-github" ;;
|
github) change_color_scheme "base16-github" ;;
|
||||||
|
|
Loading…
Reference in a new issue