hlissner/emacs-solaire-mode

Use (get face 'theme-face) instead of (face-attribute) to face-swap

gagbo opened this issue · 1 comments

gagbo commented

When switching between GUI and TTY solaire-mode breaks the backgrounds of faces (TTY will try to use GUI colors and/or GUI will try to use 256-color colors)

As discussed :

Oh, actually, it's just because the bg swap is primitive: https://github.com/hlissner/emacs-solaire-mode/blob/master/solaire-mode.el#L233-L237. I'll have to look into a deeper face swap, rather than simply swapping strings

The only way I found to get the original (min-colors XXX) ... values was to use (cadar (get face 'theme-face)) but some error-checking is probably necessary to be sure it would work as expected

I extracted this solution from emacs' faces library, and I don't think these values are exposed elsewhere after being set in a theme https://github.com/emacs-mirror/emacs/blob/3480071dfab30eaca7f1d014600b864d2ea22f62/lisp/faces.el#L1673-L1678

As of 56f6d9e solaire-mode now swaps faces' entire specs as you've suggested, which allows them to inherit all their classes and fixes solaire-mode in the terminal. Thanks for bringing it to my attention!