Question

I am running Emacs 24.1. On my .emacs start file I have the following line:

(load-theme 'tango-dark t)

However, when I run an ansi-term terminal, the background colors don't work well:

                          enter image description here

What's interesting is that for directories, the background color seems to be correct, while for some files the background color is black (even though the buffer's background color is dark grey).

I would like to either:

1: Have the background color of the buffer match the background color of the text (black in this case)

or

2: Have the background color of the text match the background color of the buffer (dark grey in this case), which in this case is configured by tango-dark.

How can I do this? (an answer for both possibilities would be ideal)

Was it helpful?

Solution

Since Emacs 24 the theming mechanism is built-in, and it is slightly different from the color-theme library used for the same purpose before, but it is very similar.

What I think happened is that somehow the theme was initialized before the setting for the terminal color was applied, or, maybe the old theme used to set this color, while the new one doesn't.

Essentially, the theme is a collection of faces, those the author of the theme believed you might use (so you can put into theme the faces that aren't built-in in Emacs). The theme, however, may set other things too, so it could've set the terminal background color using custom-theme-set-variables, or used to do that before, but not any more.

In any case, you should be always able to customize that by either customizing the face itself (which will override the theme settings), or customize the theme. You can do the first using M-xcustomize-faceRETdefaultRET and the second using M-xcustomize-themeRETtango-darkRET

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top