5d997cd59708f082978e42a91d449d603418e8a3
[~bandali/configs] / .local / bin / change-theme
1 #!/bin/sh
2
3 dark_color='black' # #222
4 light_color='white'
5
6 if [ "$1" = "dark" ]; then
7 fg="$light_color"
8 bg="$dark_color"
9 elif [ "$1" = "light" ]; then
10 fg="$dark_color"
11 bg="$light_color"
12 else
13 echo "Usage: $0 {dark|light}"
14 exit 1
15 fi
16
17 # most applications using xresources
18 printf "*.foreground: $fg\n*.background: $bg" | xrdb -override
19 # xterm, basically
20 printf "*VT100*foreground: $fg\n*VT100*background: $bg" | xrdb -override
21
22 # emacs
23 emacsclient -ue "(set-face-attribute 'default nil :foreground \"$fg\" :background \"$bg\")"
24 # terminals
25 for term in /dev/pts/*; do
26 if [ -w "$term" ]; then
27 printf "\033]10;$fg\a" > "$term"
28 printf "\033]11;$bg\a" > "$term"
29 fi
30 done