Ⅰ. 插件描述
The Toolkit for Vim Color Scheme Designers!Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'lifepillar/colortemplate'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'lifepillar/colortemplate'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'lifepillar/colortemplate'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/lifepillar/vim-colortemplate
Ⅳ. 文档说明
# 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!
Quick Start
:edit templates/default_clone.colortemplate
:Colortemplate! ~/.vim
:colorscheme default_cloneThe resulting color scheme will be written into ~/.vim/colors.
The generated color scheme replicates Vim's default color scheme. Look inside
the templates folder for other templates.
Note: :Colortemplate and other plugin's commands are filetype-specific. That
means that they are available only if the filetype is set to colortemplate.
You may need to explicitly type :set ft=colortemplate to make them available
in new buffers.
Features
- 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,
autoload/gorgeous.vimorscripts/foo.sh). - 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 :help colortemplate.txt.
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 <me@somewhere.org>
Variant: gui 256 8
Background: dark
# Color palette
Color: black #000000 ~ Black
Color: white #ffffff ~ White
# Highlight group definitions
Normal white black
# Etc…If you want to get a flavor of how Colortemplate can be used in the real world,
take a look at some color schemes created with it:
WWDC16 and
WWDC17 (simple), or
Gruvbox 8 and
Solarized 8 (complex).
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:
- The
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@term16<color>or@term256<color>instead. - There is a new
Term Colorskey, which allows you specify the 16 ASCII colors
to be used in Vim terminal windows. If you were usingverbatimblocks 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. ReplaceTerminal Colors: 256with `Variant:
gui 256; replace Terminal Colors: 256 16 with Variant: gui 256 16`; and so
- See
:help colortemplate-variantsfor more information.
- There is a new
Neovimkey: when its value isyes, additional code to
support Neovim is generated (default isno). - The
Maintainerkey is now optional. - If you were using
verbatimblocks to check for italics, you should remove
them: Colortemplate v2 deals with theitalicattribute automatically. Just
define your highlight groups as if italics is available, and let Colortemplate
do the rest.
- Many
verbatimblocks may now be replaced with#if,#let, …, commands
(see:help colortemplate-verbatim). - 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
templates (see templates/_help.colortemplate).
Backgrounddirectives accept a new value (any). You may switch betweendark,lightandanyan arbitrary number of times.- Anything before the first
BackgroundandVariantdirectives is considered
to be “in global scope” and put at the start of the generated color scheme.
You may put setup stuff in verbatim blocks there, or linked group
definitions that apply to all variants.
- Validation is now performed with
$VIMRUNTIME/colors/tools/check_colors.vim
(: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 aColorline!
Contributions
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.