Search code examples
emacscolorscolor-scheme

How do I set up Emacs colors correctly?


I've set up two versions:

My computer      apt-get   emacs 23.0.91
Remote server    yum       emacs 21.4

I've downloaded color-theme-6.6.0, put the files in /usr/share/emacs/-version-/lisp/, and I have this in my .emacs:

(require 'color-theme)
(color-theme-initialize)
(color-theme-midnight)

Running emacs in a terminal, all the colors show up correctly on my computer, but on the server, I only get two colors??? The background is one color, and the text is another, no matter what theme I choose. No errors show up when I start emacs.

Any suggestions?


Solution

  • Paraphrased from Unix and Color Highlighting:

    To be able to use syntax highlighting on a Unix/Linux box you need either a terminal that supports color. Some systems (AIX for me) require a TERMINFO file generated by tic on a xterm-color.tic file. Here's a snip:

     setenv TERMINFO /home/cfl/lib/terminfo
     tic xterm-color
     setenv TERM xterm-color
    

    Again, read the Unix and Color Highlighting article for all the details.


    On another note, this is what my .emacs file contains for setting color (on a dark background).

    ;; Maximum colors
    (setq font-lock-maximum-decoration t)
    
    (setq frame-background-mode 'dark)
    
    (setq auto-mode-alist '(("\\.ad[bs]\\'"   . ada-mode)
                            ("\\.awk\\'"      . awk-mode)
                            ("\\.lex\\'"      . c-mode)
                            ("\\.[cy]\\'"     . c++-mode)
                            ("\\.h\\'"        . c++-mode)
                            ("\\.hxx\\'"      . c++-mode)
                            ("\\.[CH]\\'"     . c++-mode)
                            ("\\.java\\'"     . java-mode)
                            ("\\.cc\\'"       . c++-mode)
                            ("\\.hh\\'"       . c++-mode)
                            ("\\.cxx\\'"      . c++-mode)
                            ("\\.cpp\\'"      . c++-mode)
                            ("\\.rc\\'"       . c++-mode) ;; resource files
                            ("\\.rcv\\'"      . c++-mode)
                            ("\\.m\\'"        . matlab-mode)
                            ("\\.p[lm]\\'"    . perl-mode)
                            ("\\.cgi\\'"      . perl-mode)
                            ("\\.f\\'"      . fortran-mode)
                            ("\\.F\\'"      . fortran-mode)
                            ("\\.f90\\'"      . f90-mode)
                            ("\\.F90\\'"      . f90-mode)
                            ("\\.el\\'"       . emacs-lisp-mode)
                            ("\\.emacs\\'"    . emacs-lisp-mode)
                            ("\\.tex\\'"      . LaTeX-mode)
                            ("\\.bib\\'"      . bibtex-mode)
                            ("[Mm]akefile\\'" . makefile-mode)
                            ("\\.mak\\'"      . makefile-mode)
                            ("\\[Mm]akefile.\\'" . makefile-mode)
                            ("\\.bat\\'"      . shell-script-mode)
                            ("\\.tar\\'"      . tar-mode)
                            ("\\.php\\'"     . php-mode)
                            ("\\.html\\'"     . html-mode)
                            ("\\.jnlp\\'"     . html-mode)
                            ("\\.xml\\'"     . html-mode)
                            ("\\.pddl\\'"     . lisp-mode)
                            ("\\.css\\'"      . css-mode)
                            ("\\.py\\'"       . python-mode)
                            ("\\.yml\\'"      . yaml-mode)
                            ("\\.lisp\\'"     . lisp-mode)))