You may use per-buffer-theme.el
. For example you could start with a setup like this:
(require 'per-buffer-theme)
(setq per-buffer-theme/use-timer t)
(setq per-buffer-theme/timer-idle-delay 0.1)
(setq per-buffer-theme/default-theme 'notheme)
(setq per-buffer-theme/themes-alist
'(((:theme . dichromacy)
(:buffernames nil)
(:modes haskell-mode
haskell-interactive-mode)))) ; Is this the mode the Haskell REPL in Emacs uses? I'm not sure.
In my testing it has worked best with per-buffer-theme/use-timer
set to non-nil. Also, you may want to tell per-buffer-theme
to avoid changing themes for some buffers (say, Help buffers). You can do it with the per-buffer-theme/ignored-buffernames-regex
variable:
(setq per-buffer-theme/ignored-buffernames-regex
(append ido-ignore-buffers '("*Completions*" "*Help*" "*info*" "*Warnings*")
per-buffer-theme/ignored-buffernames-regex))
This question had been asked on Stack Overflow a few years ago: Different color themes per mode in Emacs. There are other approaches there but notice that most answers are old and better solutions could have come up since then.