2010-04-04

the zenburn color theme

A popular way to customize emacs is changing its color scheme, as already discussed color theming. Until recently, I was using an evolved version of the color theme presented there, 'djcb-dark'. It works for me but, admittedly, it's a bit ugly.

But recently, in a post to the Wanderlust mailing list, someone mentioned a color theme called Zenburn. Zenburn started its life as a color scheme for vim, around 2002. The explicit goal was to have a pleasant theme that is light on the eyes, and allows you to stay 'in the zone' for long stretches of time. People liked it, and version for many other programs were made, including emacs.

I've been using Zenburn for the last few weeks, and I really like it. I used to think that 'low-contrast' would mean that things are not really clear; but the opposite seems true. Anyway, the screen shot says more than a thousand words I suppose…

Zenburn-for-emacs (written by Daniel Brockman) can be found at the link above. I've sent my updates to him of course, but as it may take a while for the 'official' version to be updated, I've put my version on Emacswiki: ZenburnColorTheme. The changes are the support for Wanderlust, hi-line (for highlighting the current line) , magit and elscreen; also, I made selected (eh, transiently marked regions) not loose their foreground color.

Note, the theme is not yet part of the color-theme package, but does require it.

35 comments:

be said...

I've been using Zenburn for a few months now. The one thing that doesn't convince me is, as the post mentions, that it is not high contrast.

rejeep said...

I've been using Twilight for a while now: http://redartisan.com/2008/5/27/twilight-emacs

Always fun to try out a new theme. Thanks for the tip!

Unknown said...

After I load Zenburn in my emacs, my wanderlust get error when sending email.The error message is
"Args out of range...."

OS:
Debian squezze
Emacs:
Emacs 23

I write email in Chinese/Japanese with UTF8 code.

Need help. Thank you very much.

djcb said...

@rejeep: ah, yes, twilight looks nice as well; as of now, it's a bit less
complete than zenburn, but I can see it go there. Thanks for the tips.

@Xiang Ruang: hmmmm... any specific backtrace? (i.e., start Wanderlust after
doing 'M-x toggle-debug-on-error'). I am using the E23 + Wanderlust + zenburn
without any problems.

Viola Pastor said...

I like this theme, and I don't like many of them.

What I can't figure out, though, is why the tooltips are shown in a
face that can't be picked out from the background. (There must be a
better way to explain that...)

Dan

Massimo said...

Very good. I use Wanderlust and Zenburn
and LaTeX (so a lot of Flyspell...)

This modifications really beautify my emacs!

Anonymous said...

Nice. I use the Tango theme most of the time, but I'll probably use this one every now and then.

djcb said...

@Bratsche-freude: hmmm... for me, the tooltips are quite visible (black on whitish-yellow). There is the 'tooltip' face for that, but zenburn does not touch that. Maybe you are starting from a theme that does, and makes it unreadable if you use zenburn after that?

You could (re)set it explicitly with:

(set-face-foreground 'tooltip "black")
(set-face-background 'tooltip "lightyellow")

Unknown said...

When I change the position for the following config code in my .emacs ( change to the end of .emacs)

(require 'zenburn)
(unless (zenburn-format-spec-works-p)
(zenburn-define-format-spec))

wanderlust can send mail correctly.

I still dont know the exact reason for this, anyway, I got my problem solved.

THX

Viola Pastor said...

Thanks! That's exactly what I needed!

ltsampros said...

On every application that I use that has skin/colorscheme functinality, the FIRST thing i do is to search for a zenburn theme (I even found a Konsole one).

I've been using it everywhere for the last couple of years and it's perfect :D

none said...

how use this??

Anonymous said...

@oppor:

;;-----
(require 'color-theme)
(color-theme-initialize)
(load "~/.emacs.d/zenburn")
(color-theme-zenburn)
;;-----

remember to put the zenburn.el file in ~/.emacs.d/

I love zenburn but anyone else find the cursor/highlighting to be a bit bright? It makes the characters underneath hard to see...

I edited the matching paren color to be less bright, and also the cursor to be narrow:

(add-to-list 'default-frame-alist '(cursor-type . (bar . 2)))

Still have to figure out how to dim the highlighting color (for transient-mark-mode)...

Sergio said...

I've been using it since I saw your post, and what can I say? It's awesome!!!

Keep rockin' djcb

Kao said...

I was having some problems making it work on Aquamacs so I wrote a version using the builtin custom-theme engine instead of color-theme. If anyone want to check it out it's on http://bitbucket.org/kcfelix/zenburn-theme.el

djcb, I don't use the packages your updates are for, but I'll incorporate them on my version as well if you don't mind.

djcb said...

@Kao: cool! I've planning to look into custom-theme, I'm going to give your mode a try.

krz said...

hi
I originally posted the zenburn theme to the wanderlust list. I switched back to mutt so I did not read the list any more, sorry.
You merged the settings to the theme, so all probs to you!
Your blog makes me want to dig deeper into it and perhaps give wanderlust another try :)
Great blog, I love it.

djcb said...

@krz: ah thanks, you did all the hard work :)

Bill White said...

zenburn for emacs: quiet, peaceful, beautiful. many thanks -

Byron said...

Emacs noob here. In which emacs directory do you put the zenburn.el file? Been searching for this answer all over the net with no luck.

djcb said...

@Byron: see installing
packages
. Basically, you need to add some directory (say, ~/.emacs.d/elisp/) to the 'load-path', and put zenburn.el there.

Anonymous said...

For those who are interested, I did a Google Chrome theme based on Zenburn:

https://chrome.google.com/extensions/detail/hakjkjcbffhnjeghcfdckehklpeifoma

So you can rest your eyes while surfing as well ;)

kakachi sensei said...

Hi,

I found this smart tool to help create an emacs theme. Actually I find it quite simple and intuitive. Hope you will appreciate http://alexpogosyan.com/color-theme-creator/

Anonymous said...

I tried the zenburn.el found here: http://www.brockman.se/software/zenburn/zenburn.el. It absolutely doesn't look as supposed. It is similar to the emacs theme cheap goldenrod. I am using emacs 23.2 on a kubuntu 10.04 LTS. Have you put some custom-set-faces before adding zenburn staff?

djcb said...

@Anonymous: I can sort-of reproduce that when I don't load the color-theme package before zenburn -- so it hopefull works for you when you do a

(require 'color-theme)

first.

Anonymous said...

Actually I found out what is the problem: it seems that the zenburn theme is not adapted to console mode. In deed, when calling emacs in window mode it behaves quite good but in no window mode it reverts to cheap goldenrod settings. Is there a way to fix and make it react the same in both modes?

Anonymous said...

Is there way to modify this (or some other) theme to draw not only horizontal bar but also vertical bar in order to highlight cursor?

I mean it would be neat to see cursor in the middle of cross of 2 bars highlighting both row and column - the same way it is implemented in ultraedit for example.

Any hints?

djcb said...

@Anonymous: see CrosshairHighlighting

Anonymous said...

Thank you!

More noob questions - how to actually use it:

plave crosshairs.el into ~/emacs.d/
and add to ~/emacs.d/init.el:

(require crosshairs)
(global-set-key [(control ?+)] 'crosshairs-mode)

??

djcb said...

@Anonymous: Well, see this
old emacs-fu post
; then you need to get vline.el, col-highlight.el, hl-line+.el
and crosshairs.el.

In your .emacs do a
(require 'crosshairs)

and whenever you want to use it, use M-x crosshairs-mode (same to toggle it off again).

Anonymous said...

djcb thanks a lot!

I beg your pardon for offtopic but can you point me towards some description of start\restart\shutdown of emacs?

To be more precise I use emacs --daemon which autoloads everytime I logon to ubuntu.

There are obvious problems: I didn't managed to find a way to gracefully shutdown it upon logout - which leads to question about potential file conflicts on next logon (due to some garbage leftovers I presume).

Another thing - is how to kick emacs daemon to re-read configuration?

Anonymous said...

Speaking of zenburn and crosshair: when I enable crosshair-mode vertical bar have a different color than horizontal.

How to make them equal?

Preferrably not by setting colors manually but to force crosshair to use theme colors so when I change theme it'll pick up proper colors automatically.

djcb said...

@Anonymous, crosshairs has support for that already, by default the color should follow the hl-line color (see crosshairs-vline-same-face-flag) -- assuming you use hl-line-mode for highlighting the current line.

djcb said...

another @Anonymous: note that you can use emacsclient --eval to execute commands, e.g. save-buffers-kill-emacs or something more sophisticated to close the emacs server.

Anonymous said...

I really like the theme, but ended up having problems when using it on the latest emacs 24 build via git. I found that when I did a (load-theme 'zenburn) that some of the inherited styles were often misapplied. In the end, I found that following seemed to work reliably as the last stanza of my ~/.emacs.d/init.el:

;; Set color theme only if using a windowing system and emacs 24 or higher.
(when (and (window-system)
(>= emacs-major-version 24))
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(load-theme 'zenburn)
;; HACK: load-theme has issues, load the file as well
(load-file "~/.emacs.d/themes/zenburn-theme.el"))