← Back to DAGDA | Support | Source: https://github.com/bbatsov/zenburn-emacs
Skip to content

About

The Zenburn colour theme ported to Emacs

Topics

Resources

Contributing

Stars

1.1k stars

Watchers

30 watching

Forks

Repository files navigation

zenburn-theme for Emacs

CI License GPL 3 MELPA MELPA Stable

About

Zenburn for Emacs is a direct port of the popular Zenburn theme for vim, developed by Jani Nurminen. It's my personal belief (and that of its many users I presume) that it's one of the best low contrast color themes out there and that it is exceptionally easy on the eyes.

This theme uses the "new"1 built-in theming support available starting with Emacs 24.1.

Overview screenshot


ko-fi Patreon

Variants

The canonical Zenburn comes in exactly one variant - the dark one that you get with (load-theme 'zenburn t). Everything else here is not a port of anything, so you have only me and my (poor) creative vision to blame for it.

Theme Background Description
zenburn #3F3F3F The original.
zenburn-high-contrast #1F1F1F The same colors on a much darker background.
zenburn-light #E7E0CA A light take on Zenburn, on a warm paper background.
zenburn-high-contrast
zenburn-high-contrast
zenburn-light
zenburn-light

zenburn-high-contrast is for those of you who like the palette, but find the original a bit too washed out. It borrows the background of the high contrast mode of the Vim theme and keeps the accent colors as they are.

zenburn-light is for the days when a dark theme doesn't work for you. Every color of the original keeps its hue and (more or less) its contrast against the background, so you get the same muted, low contrast look.

Installation

Package.el

Zenburn is available in NonGNU ELPA, MELPA Stable and MELPA.

You can install it with the following command:

M-x package-install RET zenburn-theme RET

To load it automatically on Emacs startup add this to your init file:

(load-theme 'zenburn t)

If you prefer to use use-package just add the following:

(use-package zenburn-theme
  :ensure t
  :config
  (load-theme 'zenburn t))

Replace zenburn with zenburn-high-contrast or zenburn-light to use one of the variants.

Manual

Download zenburn-theme.el (and the other .el files, if you want the variants) to the directory ~/.emacs.d/themes/. Add this to your .emacs (or init.el):

(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")

Now you can load the theme with the interactive function load-theme like this:

M-x load-theme RET zenburn RET

Emacs Prelude

Zenburn for Emacs is already bundled into Emacs Prelude. If you're a Prelude user - you're probably already using Zenburn, since it's Prelude's default color theme. You can load Zenburn at any time by M-x load-theme RET zenburn RET.

Debian and Ubuntu

Users of Debian 9 or later or Ubuntu 16.10 or later may simply apt-get install elpa-zenburn-theme.

Usage

You can load any of the themes with load-theme, or switch between them with M-x zenburn-select, which also disables the variant you were using. On Emacs 29+ the built-in M-x theme-choose-variant works as well.

Both commands work out of the box if you've installed the theme as a package. With a manual installation you'll need a bit more setup: zenburn-select lives in zenburn-select.el, which has to be on your load-path, and theme-choose-variant will know only about the variants you've already loaded.

(add-to-list 'load-path "~/.emacs.d/themes/")
(require 'zenburn-select)

Customization

Custom colors

If you'd like to tweak the theme by changing just a few colors, you can do so by defining new values in the zenburn-override-colors-alist variable before loading the theme.

For example, to customize just the lighter background colors, you could add to your init file:

(setq zenburn-override-colors-alist
      '(("zenburn-bg+05" . "#282828")
        ("zenburn-bg+1"  . "#2F2F2F")
        ("zenburn-bg+2"  . "#3F3F3F")
        ("zenburn-bg+3"  . "#4F4F4F")))
(load-theme 'zenburn t)

To see the full list of color names you can override, consult the zenburn-theme.el source file.

On top of the palette there's a small set of colors named after what they are used for - zenburn-comment, zenburn-string, zenburn-keyword, zenburn-error and so on. You can point any of them to a different palette entry (or a hex color) with zenburn-override-semantic-colors-alist:

(setq zenburn-override-semantic-colors-alist
      '(("zenburn-comment" . zenburn-fg-05)   ; grey comments
        ("zenburn-string"  . "#C9A0A0")))
(load-theme 'zenburn t)

The variants share their face definitions and options with the original, but each has a palette of its own. Use zenburn-high-contrast-override-colors-alist and zenburn-light-override-colors-alist (and their -semantic- counterparts) to tweak their colors. The color names are the same as those of the dark theme.

Custom faces

If you want to change some faces you can do it with custom-theme-set-faces. The zenburn-with-color-variables macro binds all the colors of the palette as local variables, so you don't have to hardcode any hex values:

(load-theme 'zenburn t)

(zenburn-with-color-variables
  (custom-theme-set-faces
   'zenburn
   `(region ((t (:background ,zenburn-blue-5))))
   `(font-lock-comment-face ((t (:foreground ,zenburn-green+1 :slant italic))))))

Note that zenburn-with-color-variables always gives you the colors of the original theme.

See this article for more details.

Scaled headings

The theme supports scaling the font size for some headings and titles as well as using a variable-pitch font for those. To enable this, use the following settings before loading zenburn-theme:

;; use variable-pitch fonts for some headings and titles
(setq zenburn-use-variable-pitch t)

;; scale headings in org-mode
(setq zenburn-scale-org-headlines t)

;; scale headings in outline-mode
(setq zenburn-scale-outline-headlines t)

With these settings, an Org buffer with headings looks like this:

Scaled screenshot

Automatic light/dark switching

Now that there's a light variant, Zenburn can follow the appearance of your OS or the time of the day with the help of a couple of third-party packages:

  • auto-dark tracks your OS dark/light mode and switches themes to match:
(use-package auto-dark
  :config
  (setq auto-dark-themes '((zenburn) (zenburn-light)))
  (auto-dark-mode 1))
  • circadian switches on a time-based schedule (e.g. sunrise/sunset):
(use-package circadian
  :config
  (setq circadian-themes '((:sunrise . zenburn-light)
                           (:sunset  . zenburn)))
  (circadian-setup))

See Automatic Light/Dark Theme Switching for a deeper look at both approaches.

FAQ

Wrong colors in the terminal Emacs version

If your Emacs looks considerably uglier in a terminal (compared to the GUI version) try adding this to your .bashrc or .zshrc:

export TERM=xterm-256color

Source the .bashrc (or .zshrc) file and start Emacs again.

Bugs & Improvements

Please, report any problems that you find on the project's integrated issue tracker. If you've added some improvements and you want them included upstream don't hesitate to send me a patch or even better - a GitHub pull request. These contributors have done so.

Donate

You can support my work on Zenburn and all my other OSS projects via the following platforms:

Changelog

A fairly extensive changelog is available here.

License

Copyright © 2010-2026 Bozhidar Batsov and contributors.

Distributed under the GNU General Public License, version 3

Footnotes

  1. It used to be new in 2010 when I created this package. ↩

About

The Zenburn colour theme ported to Emacs

Topics

Resources

Contributing

Stars

1.1k stars

Watchers

30 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages