Saltycrane logo

SaltyCrane Blog

Notes on Python, Django, and web development on Ubuntu Linux

    

Emacs mode line color custimization

If you have more than one window in your emacs session, it's nice to make the active window stand out by changing the color of the mode line. In my standard Windows emacs installation, the active window's mode line is gray and the inactive window's is light grey. This makes it difficult to distinguish which window is active. By adding the following line to your .emacs file, you can make the active window's mode line blue instead of gray.

(set-face-background 'modeline "#4477aa")

It'd be nice if I could make a thin blue border surrounding the window like in Eclipse, but I couldn't figure out how to do that. The commented-out lines in the screenshot didn't do the trick.

7 Comments — feed icon Comments feed for this post


#1 Rich commented on 2008-05-17:

Ahh, thanks for this. Somehow an upgrade of ubuntu caused the active modeline and active modeline's text to be the same color... couldn't see anything. So, thanks for helping me fix that!


#2 Windsor Schmidt commented on 2008-05-28:

Thanks, this did the trick for me!


#3 yung choi commented on 2008-10-27:

How can I set the custom color for the modeline of the non-active window? My non-active window's modeline is same color as that of text buffer. So it is hard to distinguish it when I do ediff. Thank you for any help, - yung


#4 Eliot commented on 2008-10-27:

Yung, I actually would like to know how to do this as well. If you figure it out, please let me know.


#5 tapio commented on 2009-01-12:

Maybe 'modeline-inactive is what you should use? For emacs 22.2.1 my .emacs contains:

;; see http://www.gnu.org/software/emacs/manual/html_node/emacs/Standard-Faces.html
(set-face-background 'modeline          "#4466aa")
(set-face-background 'modeline-inactive "#99aaff")
(set-face-background 'fringe "#809088")

#6 Eliot commented on 2009-01-20:

thank you very much, tapio! that did the trick!


#7 Seth commented on 2009-02-26:

Here's how I get a box around the active mode-line:

(custom-set-faces
   '(mode-line ((t (:box (:line-width 2 :color "red"))))))

There's probably a better way to do it but this works for me.

Post a comment

Required
Required, but not displayed
Optional

Format using Markdown. (No HTML.)
  • Code blocks: prefix each line by at least 4 spaces or 1 tab (and a blank line before and after)
  • Code span: surround with backticks
  • Blockquotes: prefix lines to be quoted with >
  • Links: <URL>
  • Links w/ description: [description](URL)
Created with Django | Hosted by Slicehost