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.
Related posts
- Magit in Spacemacs (evil-magit) notes — posted 2018-11-02
- Switching from Emacs to Vim (actually Spacemacs) — posted 2015-12-31
- Colorized, interactive "git blame" in Emacs: vc-annotate — posted 2011-05-28
- My Emacs Python environment — posted 2010-05-10
- Emacs espresso-mode for jQuery — posted 2010-03-10
- Notes on C++ development with Emacs on Ubuntu Linux — posted 2009-07-08
Comments
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!
Thanks, this did the trick for me!
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
Yung, I actually would like to know how to do this as well. If you figure it out, please let me know.
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")
thank you very much, tapio! that did the trick!
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.