There are two ways to open Emacs in the terminal. emacsclient -nw
(connects to an existing daemon) and emacs -nw
(creates a new instance of Emacs in the terminal). The background of the daemon terminal frame will be different – sometimes an ugly shade of your chosen theme’s highlight.
(left: emacsclient -nw
, right: emacs -nw
)
This occurs because the solaire-mode
plugin tries to use a slightly off-background color for your real, file-visiting buffers, but while this looks great in GUI Emacs…
It doesn’t in the terminal because terminals only support 256 colors (by default). There, a subtle shade is difficult to achieve, so Emacs approximates, and often does so poorly.
Doom disables solaire-mode
when you start tty Emacs (emacs -nw
), but cannot do this for daemon users; it cannot guess what kind of frame you’re will open, so it’s leave to users to disable it themselves.
Why is there no permanent solution?
Two reasons:
-
Users can open graphical or terminal frames from a daemon session. It is impossible to guess which the user will use, primarily. Doom assumes GUI frames and leaves solaire-mode
on (leaving it to uses to disable it otherwise).
-
There is no such thing as frame-local themes or face customizations in Emacs, so solaire-mode
cannot apply itself on a per-frame basis.
The :ui doom
module does try to guess, but it appears to only work for some and not others, and will affect all open frames, graphical or otherwise.
What is the workaround?
There are two:
- Disable
solaire-mode
. If you intend to use Emacs primarily in the terminal.
- Add
(package! solaire-mode :disable t)
to ~/.doom.d/packages.el
- Run
doom sync
- Restart Emacs.
- Adopt a terminal with 24-bit color support. Add
COLORTERM=truecolor
to your environmental variables (shell, systemd service, etc.).
I want Emacs’ background to match my terminal
In addition to the workarounds above, the following snippet will make Emacs’ background “transparent”, therefore matching your terminal:
;; add to ~/.doom.d/config.el
(custom-set-faces!
'(default :background nil))
Check out “How to switch, customize, or write themes” for more on customizing your theme’s faces.