0

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)

Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
  • I tried to reproduce the problem in `emacs -Q` but there was no mimatch of colors and the colors used by the terminal were not the theme ones. – Nicolas Dudebout Sep 21 '12 at 18:01
  • Thanks @wvxvw, your comment pointed me in the right direction. I had `(setq term-default-bg-color "#211E1E")` in a hook for ansi-term. From your comment I understand that starting with Emacs 24, controlling the buffer color is the responsibility of the `color-theme` that I load (I think this was not the case in previous versions of Emacs), and that I can now change this color if I wish with `customize-theme` and `customize-face`. If you provide your comment as an answer I"ll accept it and clarify my OP. – Amelio Vazquez-Reina Sep 21 '12 at 19:26

1 Answers1

1

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