hlissner/emacs-solaire-mode

Only use contrast bg when solaire mode is on

tam5 opened this issue · 1 comments

tam5 commented

I feel like this should be simple, rather than the hacks I have been trying.

I've been using doom-themes to create a theme

  ;; name        default   256       16
  ((bg         '("red"     nil       nil))
   (bg-alt     '("green"     nil       nil))

Ideally, when solaire mode is on, the 'editor' buffer should get the 'green' background, while the rest of the buffers, like treemacs, should be 'red'. However, when solaire-mode is off, I'd like for all the buffers to be 'green'.

@hlissner you usually have a quick solution, so i figured I'd ask.. thanks!

I think, what I could do is flip bg and bg-alt and then have my theme register a hook to call swap-bg, but not sure if there is a better way.

You'll need to swap them with solaire-mode-swap-bg; it was written for this purpose, so that you don't have to impose the swapped bg on your non-solaire users.

If you're using doom-emacs, you'd put it on doom-load-theme-hook. If you aren't you'd need to advise load-theme:

(defun swap-bg-after-theme (theme &optional _no-confirm no-enable)
  (when (and (not no-enable) (eq theme 'my-theme))
    (solaire-mode-swap-bg)))
(advice-add #'load-theme :after-while #'doom--run-load-theme-hooks-a)