From 702b15fceeb4713f81cbcf3df0282fe5051d9021 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Thu, 9 Feb 2023 00:02:29 -0700 Subject: [PATCH] Add termtrans variable Similar to the one in the Vim theme. Previously the theme always behaved as if this had the default value. --- solarized-definitions.el | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/solarized-definitions.el b/solarized-definitions.el index cee5e5d..8e53959 100644 --- a/solarized-definitions.el +++ b/solarized-definitions.el @@ -14,6 +14,19 @@ Ported to Emacs by Greg Pfeil, http://ethanschoonover.com/solarized.") :group 'faces :prefix "solarized-") +(defcustom solarized-termtrans '(:background :foreground) + "Whether to avoid specifying the background color in certain frames. +Terminals which support less than 16 colors can sometimes set the default +background and/or foreground to colors distinct from the 8 used otherwise, +potentially expanding the palette to 9 or 10 colors. + +However, enabling this also means that you can’t switch to a background mode +other than the one your terminal is set to. I.e., if the terminal background is +dark, then you can only use the theme in dark mode, and if the terminal +background is light, you can only use the theme in light mode." + :type '(set (const :background) (const :foreground)) + :group 'solarized) + (defcustom solarized-termcolors 16 "The number of colors to use on 256-color terminals. This is set to 16 by default, meaning that Solarized will attempt to use the @@ -140,9 +153,11 @@ LIGHT is non-nil." ;; user to have the right colors set for them. (unless (and (= index 5) (or (and (eq property :background) - (eq color-name 'back)) + (eq color-name 'back) + (member :background solarized-termtrans)) (and (eq property :foreground) - (member color-name '(base0 base1))))) + (member color-name '(base0 base1)) + (member :foreground solarized-termtrans)))) (nth index (assoc color-name (solarized--current-colors light))))))))