I'd like my *scratch* buffer to have it's own color theme, different to the one I use elsewhere, so that I know when I'm working there. How can I do this?


2 Answers 2


If you just want to put *scratch* in its own frame and use special frame parameters for it (e.g. give it its own background color, font, or whatever) then you can do this just by doing these two things:

  • Customize special-display-alist to have the frame parameters you want.
  • Customize special-display-buffer-names, adding *scratch* to it.

In a comment you asked for code. No, the right way is to use Customize: M-x customize-option special-display-alist, choosing what you want, then saving persistently. Likewise, M-x customize-option special-display-buffer-names.

If the Customize UI is too complex for someone then they shouldn't be asking for code instead. ;-) That's my motto.

But since I'm an easy touch, here's a hint:

(add-to-list 'special-display-buffer-names "*scratch*")
(setq special-display-frame-alist  (append '((foreground-color . "Brown")
                                             (background-color . "LightBlue")) 
  • Help for the two special-display- variables indicates that they are obsolete since 24.3; use ‘display-buffer-alist’ instead.
    – SabreWolfy
    Feb 1, 2019 at 12:04
  • 1
    Yeah, sure, go ahead and use display-buffer-alist (overkill) instead, if you're a masochist. ;-) I don't consider them to be obsolete - that deprecation is misguided, IMHO. And thank goodness they are still supported. If they do what you want, I say go for it - simpler is better. If, in some complex corner situation, they don't seem to do what you want, go for display-buffer-alist if you want. (They're sufficient for me, but what do I know?) Special-display is a simple, useful feature. Its goal is not the same as the much more general (and complex) display-buffer-alist.
    – Drew
    Feb 1, 2019 at 19:02

You could use an external package like https://github.com/vic/color-theme-buffer-local to accomplish this.

(use-package load-theme-buffer-local
  :defer 2 ; You may not need this line, but was needed in my setup
  (load-theme-buffer-local 'misterioso (get-buffer "*scratch*")))

If you kill the scratch buffer and created a new one, the theme will be lost.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.