tinted-theming / base16-emacs

Base16 themes for Emacs
MIT License
382 stars 76 forks source link
base16 emacs theme

[[https://stable.melpa.org/#/base16-theme][file:https://stable.melpa.org/packages/base16-theme-badge.svg]] [[http://melpa.org/#/base16-theme][file:http://melpa.org/packages/base16-theme-badge.svg]]

[[https://github.com/tinted-theming/home][Tinted Theming]] provides carefully chosen syntax highlighting and a default set of sixteen colors suitable for a wide range of applications. Tinted Theming is not a single theme but a set of guidelines with numerous implementations.

This repository contains the Emacs templates and [[http://melpa.org/#/base16-theme][MELPA]]. It can be built by using one of the builders listed on the main Tinted Theming 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 [[https://stable.melpa.org/#/base16-theme][MELPA stable]] and [[https://melpa.org/#/base16-theme][MELPA]].

You can install it with the following command:

+begin_src text

M-x package-install base16-theme

+end_src

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):

+begin_src emacs-lisp

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

+end_src

*** use-package

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

+begin_src emacs-lisp

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

+end_src

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-background= - 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:

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

** Previews

Theme previews can be found [[https://tinted-theming.github.io/base16-emacs/][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:

+begin_src emacs-lisp

;; 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))

+end_src

** 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:

+begin_src emacs-lisp

(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))

+end_src

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.

Current maintainer: [[https://github.com/belak][belak]]

Previous maintainers: