Toggle darkmode in xfce4-terminal & VIM
23. 7. 2021 #kód
~/bin/darkmode.sh
#!/usr/bin/env bash f=${XDG_CONFIG_HOME:-~/.config}/xfce4/terminal/terminalrc grep -Fq 'ColorBackground=#ffffff' $f if [ $? -eq 0 ]; then # currently white background sed -i \ -e 's/ColorForeground=.*/ColorForeground=#ffffff/' \ -e 's/ColorBackground=.*/ColorBackground=#000000/' $f echo 1 > ~/.dark-mode-activated else # currently dark background sed -i \ -e 's/ColorForeground=.*/ColorForeground=#000000/' \ -e 's/ColorBackground=.*/ColorBackground=#ffffff/' $f echo 0 > ~/.dark-mode-activated fi
.vimrc
autocmd FocusGained * call TweakColors() command! -nargs=0 Darkmode execute 'silent !bash ~/bin/darkmode.sh' | call TweakColors() function TweakColors() let darkmode = readfile(expand('~/.dark-mode-activated'))[0] if darkmode == '1' colorscheme molokai else colorscheme whitedust endif endfunction