Skip to content

Instantly share code, notes, and snippets.

@raszi
Last active September 18, 2022 20:14
Show Gist options
  • Save raszi/1ed88a3ee079425725db0c02ae2c7c2a to your computer and use it in GitHub Desktop.
Save raszi/1ed88a3ee079425725db0c02ae2c7c2a to your computer and use it in GitHub Desktop.
Git-delta auto dark mode

Dark Mode Tips

This gist has various tips to get your CLI tools aware of the appaerance of the system. If you terminal changes its background color from light to dark during late hours it is quite inconvenient to have the wrong colorschemes.

Install dark-mode-cli

You can either install it with Homebrew or with npm

Homebrew

brew install dark-mode

npm

npm install -g dark-mode-cli

Install delta

brew install git-delta
[core]
pager = delta
[delta]
side-by-side = true
let darkModeStatus=system("dark-mode status")
if darkModeStatus =~ "off"
set bg=light
else
set bg=dark
endif
#!/usr/bin/env bash
if [ "$(dark-mode status)" = "off" ]
then
/usr/local/bin/delta --light "$@"
else
/usr/local/bin/delta --dark "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment