summaryrefslogtreecommitdiffstats
path: root/.local/bin/change-theme
blob: 7b20bde01fce8145b6488d3d5b3101718d9d5bb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

dark_color='black' # #222
light_color='white'

if [ "$1" = "dark" ]; then
    fg="$light_color"
    bg="$dark_color"
elif [ "$1" = "light" ]; then
    fg="$dark_color"
    bg="$light_color"
else
    echo "Usage: $0 {dark|light}"
    exit 1
fi

# most applications using xresources
printf "*.foreground: $fg\n*.background: $bg" | xrdb -override
# xterm, basically
printf "*VT100*foreground: $fg\n*VT100*background: $bg" | xrdb -override

# emacs
if [ "$(pgrep -u $USER emacs)" ]; then
    emacsclient -ue "(set-face-attribute 'default nil :foreground \"$fg\" :background \"$bg\")"
fi
# terminals
for term in /dev/pts/*; do
    if [ -w "$term" ]; then
        printf "\033]10;$fg\a" > "$term"
        printf "\033]11;$bg\a" > "$term"
    fi
done