Question

I am trying to make an Emacs color-theme for my terminal which sets colors for all the text and such, but uses the default background from the terminal- mainly because I like the transparency settings that my terminal profile has. Going into my color-theme (I use color-theme-tomorrow-night) and deleting the background color achieves what I'm looking for, but not without throwing an error every time I open Emacs. Thanks for your help.

EDIT: Made a new variant of color-theme-tomorrow-night, thanks to help from Mawile. Here it is, works as expected:

(defun color-theme-tomorrow-night-term ()
  "Dark Tomorrow theme with background color removed for badass
terminal transparency"
  (interactive)
  (color-theme-tomorrow-real "nil" "#282a2e" "#373b41" "#c5c8c6" "#969896"
                             "#cc6666" "#de935f" "#f0c674" "#b5bd68" "#8abeb7"
                             "#81a2be" "#b294bb" "#aeafad"))
(provide 'color-theme-tomorrow-night-term)
Was it helpful?

Solution

You can always set it to "nil" (Without the quotes) instead of deleting it... "nil" is Emacs' version of "null" or, "false", or "nonexistant"...

Pretty much what that would do is allow Emacs to see the variable, and stop it from barfing when it looks for it. It will see the variable, but it won't set your background color to anything since it's set to this magical "nil" thing, effectively providing the same functionality in this case as when you deleted the variable, but without the error.

I imagine this is the theme you are using? In this case, you would put the "nil" on line 16...

If you want to test it, the following will set your background color to "nil". (You can eval this code by pasting it anywhere in Emacs, moving the cursor after the last bracket, and hitting "C-x C-e").

(set-background-color nil)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top