Make emacs in terminal use dark colors, not light font colors

I am using emacs on macOS 10.6 with terminal. I have a white background.

It is very difficult to read the quoted C ++ lines. They grow in a pale green color. Keywords are in turquoise.

After searching through the source, I cam on cpp.el and determined that I was using the cpp-face-light-name-list instead of the cpp-face-dark-name-list.

Obviously, this function should select 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 work.

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

Thank!

+2


source to share


5 answers


I have the same problem, my selected themes are always not readable on the terminal. The answer is to use the color theme package as others have said, then select one theme for Emacs in the terminal and another theme for Emacs running in its own window, something 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. Likewise, you can add hooks for the major modes to change the color theme depending on what code you are editing.

+4


source


As stated in one of the comments - check out the color theme . This is a much more general solution to problems like yours, and much easier to use than manually adjusting the fonts.



+3


source


If you explicitly set the default front to black and the background to white ( M-x customize-group basic-faces

), font locking will ensure everything is automatically readable. These two colors are the only ones you need to set if all you need contrasts sufficiently with the font's readability.

I tried colortheme.el and especially with emacs23 it tends to make things less readable rather than more readable, I had to restart to restore the faces it set for unreadable foreground / background combines and was not reset.

+1


source


it may be wise to make sure your terminal is color-coded: export TERM=xterm-256color

0


source


This is another way to do it, and is especially useful if you are using daemon mode in Emacs 23+. When using daemon mode, sometimes a graphical client and sometimes a terminal client are used. The "snippet" below tries to figure out which client you are using and then switches to the appropriate theme (from color-theme-selection). Found it on emacswiki.

(require 'color-theme)
(eval-after-load "color-theme"
    (color-theme-initialize))

;; http://www.emacswiki.org/emacs/ColorTheme#toc10
;; select theme - first list element is for windowing system, second is for console/terminal
(setq color-theme-choices 
      '(color-theme-tangotango color-theme-standard))

(funcall (lambda (cols)
           (let ((color-theme-is-global nil))
             (eval 
              (append '(if (window-system))
                  (mapcar (lambda (x) (cons x nil)) 
                      cols)))))
         color-theme-choices)

(require 'cl)
(fset 'test-win-sys 
      (funcall (lambda (cols)
             (lexical-let ((cols cols))
               (lambda (frame)
                 (let ((color-theme-is-global nil))
               (select-frame frame)
               (eval 
            (append '(if (window-system frame)) 
                (mapcar (lambda (x) (cons x nil)) 
                    cols)))))))
               color-theme-choices ))
(add-hook 'after-make-frame-functions 'test-win-sys)

      

0


source







All Articles