May 24, 2019

Buffer-specific background color in Emacs

If you want to set a different background color for a specific buffer, maybe, of a specific mode, you can add a hook for that mode and do something like this:

(add-hook 'neotree-mode-hook (lambda ()
    (setq buffer-face-mode-face `(:background "#211C1C"))
    (buffer-face-mode 1)))

You can also toggle linum-mode or set the value for left-fringe-width, right-fringe-width, they’re only affects the current buffer.

The following screenshot is the example of my setup, changing the background color for neotree-mode and term-mode to have a fancy look:

* Work in progress
Hey! Have you tried Pomoday?
It's a keyboard-oriented, very easy to use and very powerful web-based task management software.
Powered by a lot of ☕