Base16 themes for Emacs
Emacs Lisp Other
Clone or download

README.org

https://stable.melpa.org/packages/base16-theme-badge.svg http://melpa.org/packages/base16-theme-badge.svg

Base16 themes for Emacs

Base16 provides carefully chosen syntax highlighting and a default set of sixteen colors suitable for a wide range of applications. Base16 is not a single theme but a set of guidelines with numerous implementations.

This repository contains the Emacs templates and MELPA. It can be built by using one of the builders listed on the main Base16 page.

If you notice anything that looks strange or if this repo is missing any scheme updates, please feel free to open an issue or submit a pull request.

Installation

package.el

base16-theme is available in both MELPA stable and MELPA.

You can install it with the following command:

M-x package-install base16-theme

To load one of the themes on emacs startup, add this to your init file (replacing base16-default-dark with the name of the theme you want):

(load-theme 'base16-default-dark t)

use-package

The use-package block is fairly similar to package.el.

(use-package base16-theme
  :ensure t
  :config
  (load-theme 'base16-default-dark t))

Note that use-package tries to defer packages if at all possible, so you may need to add :demand to the use-package block.

Customizing

There are a number of options which can be used to customize the themes. Note that they need to be set before load-theme is called.

base16-distinct-fringe-backgeround - Make the fringe background different from the normal background color. Also affects `linum-mode’ background. Defaults to true.

base16-highlight-mode-line - Make the active mode line stand out more. There are two choices for applying the emphasis: “box” draws a thin border around the active mode line; and “contrast” uses the default face’s foreground which should result in more contrast. Defaults to off (no special emphasis).”

Terminal Colors

When running emacs in a 256 color terminal, by default we assume you’re using a base16 compatible terminal theme and use the colors from that. However, if you’re using base16-shell or having trouble getting emacs to display with the correct colors it’s possible to override this using the base16-theme-256-color-source variable.

There are 3 possible values for this:

  • terminal: The default value - use the colors from a base16 compatible terminal theme.
  • base16-shell: Use the extended palate from base16-shell. This is useful for users of base16-shell.
  • colors: Use emacs to convert from the html color code to the closest color in the 256 color palate. This can sometimes fix issues with the other two modes, but if you’re using your own shell theme for the original 16 colors it can sometimes look strange.

Similar to other config values, make sure this is set before calling load-theme.

Previews

Theme previews can be found here.

It is recommended to generate screenshots by adding the gh-pages branch as a subtree (git worktree add -B gh-pages gh-pages origin/gh-pages) then using the normal generation tools (simply run screenshot.sh from the screenshots dir).

evil-mode

evil-mode doesn’t provide a way for themes to set the cursor color, so if you’re interested in matching the base16 spaceline indicator, you can use the following snippet:

;; Set the cursor color based on the evil state
(defvar my/base16-colors base16-default-dark-colors)
(setq evil-emacs-state-cursor   `(,(plist-get my/base16-colors :base0D) box)
      evil-insert-state-cursor  `(,(plist-get my/base16-colors :base0D) bar)
      evil-motion-state-cursor  `(,(plist-get my/base16-colors :base0E) box)
      evil-normal-state-cursor  `(,(plist-get my/base16-colors :base0B) box)
      evil-replace-state-cursor `(,(plist-get my/base16-colors :base08) bar)
      evil-visual-state-cursor  `(,(plist-get my/base16-colors :base09) box))

Development

Above, there’s a use-package block listed for general use, but if you want to run these themes out of the git repo, there’s a bit more work which needs to be done. I use something similar to the following:

(use-package base16-theme
  :ensure nil
  :load-path "site-lisp/base16-theme"
  :init
  (add-to-list 'custom-theme-load-path "~/.emacs.d/site-lisp/base16-theme/build")
  :config
  (load-theme 'base16-default-dark t))

This block assumes the repo is cloned to ~/.emacs.d/site-lisp/base16-theme. That needs to be added to the load path (along with specifying :ensure nil if needed so use-package doesn’t try to grab the package from melpa). Additionally, the build directory needs to be added to the custom-theme-load-path to ensure load-theme can find the themes.

Credits

Current maintainer: belak

Previous maintainers: