Search code examples
macosemacsdot-emacs

make emacs in a terminal use dark colors and not light font-lock colors


I am using emacs on MacOS 10.6 with Terminal. I have a white background.

It's very hard to read quoted C++ strings. They are coming up in pale green. Keywords are in turquoise.

After searching through the source I cam across cpp.el and have determined that I am using the cpp-face-light-name-list instead of cpp-face-dark-name-list.

Apparently this function is supposed to chose the correct list based on the background color:

(defcustom cpp-face-default-list nil
  "Alist of faces you can choose from for cpp conditionals.                                                           
Each element has the form (STRING . FACE), where STRING                                                               
serves as a name (for `cpp-highlight-buffer' only)                                                                    
and FACE is either a face (a symbol)                                                                                  
or a cons cell (background-color . COLOR)."
  :type '(repeat (cons string (choice face (cons (const background-color) string))))
  :group 'cpp)

But it doesn't seem to be working.

What should I put in my .emacs file so that I get the cpp-face-dark-list instead of cpp-face-light-list?

Thanks!


Solution

  • I have the same problem, my chosen themes are always unreadable on the terminal. The answer is to use the color-theme package, as others have said, then select one theme for Emacs in a terminal, and another theme for Emacs running in its own window, just like this:

    (require 'color-theme)
    (setq color-theme-is-global t)
    (if window-system
        (color-theme-deep-blue)   ;; Emacs in own window
        (color-theme-dark-laptop) ;; Emacs in tty
    )
    

    In Emacs, you can type M-x color-theme-Tab to get a list of available themes. Equally, you could add hooks for major modes to change the color-theme depending on what sort of code you are editing.