tags:

views:

802

answers:

3

I use the dark-blue2 color theme but it seems ugly under console. So I want to use no color theme under terminal, what can I do then?

+1  A: 

Set a "TERM" variable corresponding to a monochrome terminal before launching Emacs. For example, if you are in an xterm, use:

TERM=xterm-mono emacs -nw

If by "console" you mean the Linux console in text mode, you can try using "vt100" (or "vt320") instead.

Samuel Tardieu
+1  A: 

I use this, which works well because I use the multi-tty stuff from Emacs CVS (the future 23):

(defun mrc-xwin-look (frame)
  "Setup to use if running in an X window"
  (color-theme-deep-blue))

(defun mrc-terminal-look (frame)
  "Setup to use if running in a terminal"
  (color-theme-charcoal-black))

(defun mrc-setup-frame (frame)
  (set-variable 'color-theme-is-global nil)
  (select-frame frame)
  (cond
   ((window-system)
    (mrc-xwin-look frame)
    (tool-bar-mode -1)
    (mrc-maximize-frame))
   (t (mrc-terminal-look frame))))

(add-hook 'after-make-frame-functions 'mrc-setup-frame)

(add-hook 'after-init-hook
      (lambda ()
        (mrc-setup-frame (selected-frame))))

It picks a different color theme depending on whether the frame is running in a console or an X window. (I don't want to lose color syntax highlighting in a console.)

By the way, maximize looks like this:

(defun mrc-maximize-frame ()
  "Toggle frame maximized state"
  ;; from http://paste.lisp.org/display/54627/raw
  (interactive)
  (cond
   ((eq 'x (window-system))
    (progn
      (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
                 '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
      (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
                 '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))))
   (t
    (message "Window system %s is not supported by maximize"
         (symbol-name (window-system))))))
Matt Curtis
+4  A: 

To be slightly shorter than those guys, the variable window-system is something if you're in a window-system, and nil if you're in a terminal, So if i wanted to load color-theme-darkblue2 i would have:

(if window-system
    (progn
       (load "color-theme")
       (color-theme-darkblue2)))

and it will just use the default colors in the terminal. Of course, you could obviously load a term-friendly theme in the else-part if you wanted to:

(load "color-theme")
(if window-system
     (color-theme-darkblue2)
   (some-term-theme)))
quodlibetor