i3/.config/alacritty/swapColors.sh

20 lines
370 B
Bash
Raw Normal View History

#!/bin/bash
2023-12-27 19:56:33 -05:00
file="$(dirname $0)/alacritty.toml"
2023-12-27 19:56:33 -05:00
prefix='foreground = '
amber='"0xb98000"'
green='"0x008000"'
color=$amber
if [ -n "$1" ]
then
[ "$1" == "green" ] && color=$green
else
current=$(grep -oP '^'"$prefix"'\K.*$' "$file")
echo $current
[ "$current" == "$amber" ] && color=$green
fi
sed -i 's/^'"${prefix}"'.*/'"${prefix}${color}"'/' "$file"