Skip to content

Toggle background dark\light with all instances of vim, urxvt, xterm and etc

Notifications You must be signed in to change notification settings

petRUShka/toggle_background.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Synopsis

Script helps you to automatically switch background between dark and light version of your colorscheme in vim/neovim, Xresources (xterm, urxvt etc). It is extendible.

Optionally it is possible to setup run of the script automatically when it is dark or light. Or do it manually for example turn it to light when you are on sun or to dark when you are in a dim room.

Installation

  1. Install requirements, most all of them are optional depending of what you need.
  2. Place script in the directory within $PATH. In my case it is $HOME/bin. Example
cd ~/bin
wget https://raw.githubusercontent.com/petRUShka/toggle_background.sh/master/toggle_background.sh
  1. Make it executable: chmod +x toggle_background.sh

Usage

Toggle between light\dark

toggle_background.sh

Force dark or light:

toggle_background.sh dark
toggle_background.sh light

Configuration

You can configure it through variables inside script.

You can change GVIMRC to different place or you can use ginit.vim for nvim gui:

GVIMRC=~/.config/nvim/ginit.vim

If you use both vim and nvim it is a good idea to source gvimrc in nvim or vice versa.

By default solorized colorschemes filenames for Xresources are expected: ~/.Xsolorized.dark and ~/.Xsolorized.light but you can change basename, for example:

X_THEME_NAME=Xresources

after that change script expects ~/.Xresources.dark and ~/.Xresources.light.

Requirements

  • place dark and light colorschemes for Xresources in $HOME, by default ~/.Xsolorized.dark and ~/.Xsolorized.light are expected. Also it is necessary to include in ~/.Xresources, for example:
#include ".Xsolorized.dark"
  • unset background option in vimrc/init.nvim to vim/nvim guess background (dark\light) by the colorscheme of terminal;
  • set background in gvimrc to dark or light;
  • vim compiled with +clientserver: for vim/gvim to change background on the fly;
  • neovim-remote: for nvim and guis to to change background on the fly;
  • xrdb (X server resource database utility): for reloading Xresources config: xterm, uxterm etc;
  • urxvt-config-reload: for live reloading color scheme of urxvt.
  • pgrep: for live update colorscheme of urxvt

About

Toggle background dark\light with all instances of vim, urxvt, xterm and etc

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages