SaltyCrane Blog — Notes on JavaScript and web development

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.


#1 Rich commented on :

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!

#3 yung choi commented on :

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 :

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 :

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

;; see
(set-face-background 'modeline          "#4466aa")
(set-face-background 'modeline-inactive "#99aaff")
(set-face-background 'fringe "#809088")

#6 Eliot commented on :

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

#7 Seth commented on :

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

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

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