Colortemplate: The Toolkit for Vim Color Scheme Designers!
Colortemplate is a 100% VimScript plugin for Vim 8 that allows you to easily develop color schemes. Its ambitious goal is to become the way to create new color schemes for Vim!
:edit templates/default_clone.colortemplate :Colortemplate! ~/.vim :colorscheme default_clone
The resulting color scheme will be written into
The generated color scheme replicates Vim's
default color scheme. Look inside
templates folder for other templates.
- Generates color schemes that support all environments, from black&white to million colors, both terminal and GUI.
- Generates color schemes that load efficiently and have a consistent structure following best practices.
- Has syntax completion for highlight groups, keywords and common colors.
- Supports generating any kind of auxiliary files (say,
- Automatically provides xterm approximations for GUI colors.
- Can display information about the highlight group under the cursor.
- Computes useful statistics about your color palette.
- Is fully documented!
To know everything about Colortemplate, read
Colortemplate is based on a very simple but very flexible template format. This is a minimal template:
# vim: ft=colortemplate Full name: My Gorgeous Theme Short name: gorgeous Author: Me <firstname.lastname@example.org> Variant: gui 256 8 Background: dark # Color palette Color: black #000000 ~ Black Color: white #ffffff ~ White # Highlight group definitions Normal white black # Etc…
Migrating from v1
Users of Colortemplate v1 in most cases will still be able to build their color schemes, with just a couple of additional warnings. Anyway, to fully migrate to v2, the following must be taken into account:
Terminal Colorsdirective has been deprecated in favor of the much more flexible mechanism of variants (see below).
- The ambiguous
@term<color>interpolation pattern has been removed: use
- There is a new
Term Colorskey, which allows you specify the 16 ASCII colors to be used in Vim terminal windows. If you were using
verbatimblocks for this, you should remove them: Colortemplate v2 automatically defines
g:terminal_ansi_colors(and the equivalent for NeoVim if enabled, see below).
- There is a new
Variantdirective, which specifies to which environments the subsequent definitions apply. Replace
Terminal Colors: 256with
Variant: gui 256; replace
Terminal Colors: 256 16with
Variant: gui 256 16; and so on. See
:help colortemplate-variantsfor more information.
- There is a new
Neovimkey: when its value is
yes, additional code to support Neovim is generated (default is
Maintainerkey is now optional.
- If you were using
verbatimblocks to check for italics, you should remove them: Colortemplate v2 deals with the
italicattribute automatically. Just define your highlight groups as if italics is available, and let Colortemplate do the rest.
verbatimblocks may now be replaced with
#let, …, commands (see
- Colortemplate v2 does not generate any help file by default any more (color
schemes have no settings by default). You may need to adjust your help
Backgrounddirectives accept a new value (
any). You may switch between
anyan arbitrary number of times.
- Anything before the first
Variantdirectives is considered to be “in global scope” and put at the start of the generated color scheme. You may put setup stuff in
verbatimblocks there, or linked group definitions that apply to all variants.
- Validation is now performed with
:ColortemplateCheckcommand or Check menu entry in the toolbar).
- Statistics are generated separately from the color scheme
:ColortemplateStatsor Stats menu entry in the toolbar).
- Try typing
3gawith the cursor on a
Do you want to contribute? Do you have any suggestions on how to improve Colortemplate? Open an issue or submit a pull request!
See also the discussion that prompted the creation of this script.