Generate base16 color schemes from images
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
Macoy Madson 081ca564c1
Merge pull request #3 from Misterio77/master
před 1 rokem
images Added brightness clamping system for when the color palette is too bright před 3 roky
templates Changed template author před 1 rokem
.gitignore Added readme, updated gitignore, added skeleton script před 3 roky Remove # from color outputs před 1 rokem
LICENSE Initial commit před 3 roky Added command-line arguments před 3 roky Made convenience function paths better, reformatted před 2 roky

Auto Base16 Theme


What it does

This script generates a base16 color theme intended for code syntax highlighting from a source image.

This means you can have beautiful, readable themes which match your desktop background without having to do any work.

I currently only have a template for Emacs, but it should work for any editor which supports base16. If you create a template for your format/editor of choice, please feel free to create a pull request adding that template so others can benefit from it.


This script relies on schemer2 to choose colors from images. It then takes the output of schemer2 and selects colors which fit the base16 format. Make sure you have Go installed, then install schemer2:

go get requires Python 3.

How to Use

Run the following command, replacing your image with the image you want the theme's colors to be pulled from:

schemer2 -format img::colors -in [your image] -out colors.txt && python3 [your template] [your output file]


  • schemer2 generates the color palette from the source image and outputs a list of color values to colors.txt.

  • We then run (which loads colors.txt by default). selects from these color values (and modifies them, if necessary) such that a good theme is created. It loads your template and writes the final theme to your output file.

For example, I have an image "wallpaper.jpg" and I want an Emacs base16 theme to be generated:

schemer2 -format img::colors -in wallpaper.jpg -out colors.txt && python3 emacs-base16-theme-template.el base16-my-wallpaper-theme.el

I can then copy base16-my-wallpaper-theme.el into my Emacs base16 directory and evaluate it, then select it as a theme.

Additional Arguments

Note that running


will output help with argument descriptions.

Emacs convenience function

Here's an Emacs Lisp setup for making it easier to create new themes. You'll need to customize it with your own paths.

  (setq macoy-auto-theme-schemer2-bin "~/go/bin/schemer2.exe")
  (setq macoy-auto-theme-script-dir "~/auto-base16-theme")
  (setq macoy-auto-theme-output-file

  (defun macoy-generate-auto-theme ()
    "Create a base16 auto-theme using based on the image selected."

    (let ((default-directory macoy-auto-theme-script-dir))
       (format "%s -format img::colors -in \"%s\" -out colors.txt && C:/Python_34/python.exe emacs-base16-theme-template.el %s"
               macoy-auto-theme-schemer2-bin (read-file-name "Image: ") macoy-auto-theme-output-file))))

Example results

/code/macoy/auto-base16-theme/src/branch/master/images/Example1.jpg /code/macoy/auto-base16-theme/src/branch/master/images/Example2.jpg /code/macoy/auto-base16-theme/src/branch/master/images/Example3.jpg