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:

Leave a comment

Design a site like this with WordPress.com
Get started