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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with WordPress.com
Get started
%d bloggers like this: