mirror of
https://gitlab.com/linuxstuff/dotfiles.git
synced 2026-08-19 22:59:27 +02:00
based all colors on xresources
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
# Update alacritty config to apply Xresources color scheme
|
||||
#
|
||||
|
||||
NAMED_COLORS=("foreground" "background")
|
||||
|
||||
# Target file
|
||||
SKELETON_FILE="$HOME/.config/alacritty/alacritty.skeleton.yml"
|
||||
TARGET_FILE="$HOME/.config/alacritty/alacritty.yml"
|
||||
@@ -17,16 +19,17 @@ cp "$SKELETON_FILE" "$TARGET_FILE.tmp"
|
||||
xrdb ~/.Xresources
|
||||
|
||||
# Named colors
|
||||
foreground=$(xrdb -query | awk '/*.foreground/ { print substr($2,2) }')
|
||||
background=$(xrdb -query | awk '/*.background/ { print substr($2,2) }')
|
||||
sed -i "s/%foreground%/\x270x${foreground}\x27/g" "$TARGET_FILE.tmp"
|
||||
sed -i "s/%background%/\x270x${background}\x27/g" "$TARGET_FILE.tmp"
|
||||
for i in "${NAMED_COLORS[@]}"
|
||||
do
|
||||
color=$(xrdb -query | awk "/*.$i/ { print substr(\$2,2) }")
|
||||
sed -i "s/%$i%/#${color}/g" "$TARGET_FILE.tmp"
|
||||
done
|
||||
|
||||
# Numbered colors
|
||||
for i in {0..15}
|
||||
do
|
||||
v=$(xrdb -query | awk '/*.color'"$i":'/ { print substr($2,2) }')
|
||||
eval "sed -i 's/%color${i}%/\x270x${v}\x27/g' $TARGET_FILE.tmp";
|
||||
eval "sed -i 's/%color${i}%/#${v}/g' $TARGET_FILE.tmp";
|
||||
done
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user