vim-colortemplate

repository·master·Indexed 21 days ago

https://github.com/lifepillar/vim-colortemplate

A Vim9 script plugin for designing and generating Vim color schemes. It uses a flexible template language to create themes compatible across terminal and GUI environments, allowing developers to define metadata, color palettes, and highlight groups in .colortemplate files.

Tokens
734
Snippets
3
Records
4
Agent score
26%

What's inside vim-colortemplate

  1. Understand the Colortemplate syntax

    master

    Colortemplate uses a simple, structured format to define metadata, environments, backgrounds, color palettes, and highlight groups.

    Key sections include:

    • Metadata: Full name, Short name, and Author.
    • Configuration: Environments (e.g., gui 256) and Background (e.g., dark).
    • Color Palette: Defined using the Color: keyword followed by a name, a hex code, and an optional approximation (e.g., Color: myblack #333333 ~).
    • Highlight Groups: Defined by listing the group name followed by color names from your palette (e.g., Normal mywhite myblack).
    • Term colors: A block used to define terminal color mappings.
    Full name:    My Gorgeous Theme
    Short name:   gorgeous
    Author:       Me <me@somewhere.org>
    
    Environments: gui 256
    Background:   dark
    
    ; Color palette
    Color:        myblack #333333 ~
    Color:        mywhite #fafafa ~
    
    ; Highlight group definitions
    Normal      mywhite myblack
    
    Term colors: mywhite mywhite mywhite mywhite mywhite mywhite mywhite mywhite
                 myblack myblack myblack myblack myblack myblack myblack myblack
  2. Quick Start: Generate a color scheme

    master

    To create a new color scheme using Colortemplate, follow these steps:

    1. Create or edit a .colortemplate file.
    2. Run :Colortemplate! followed by the path to your Vim installation directory (e.g., ~/.vim).
    3. Apply the generated scheme using :colorscheme <name>.

    Important: The :Colortemplate command is filetype-specific. It is only available when the buffer's filetype is set to colortemplate. If the command is not recognized, run :set ft=colortemplate first. The generated color scheme will be written to your colors/ directory.

    :edit templates/dark.colortemplate
    :Colortemplate! ~/.vim
    :colorscheme dark
  3. Install Colortemplate via vim-devel

    master

    Colortemplate is distributed as part of the vim-devel package. To install it, clone the vim-devel repository into your Vim pack directory (e.g., ~/.vim/pack/devel).

    git clone https://github.com/lifepillar/vim-devel.git ~/.vim/pack/devel
  4. Migrate from Colortemplate v2 to the current version

    master

    The current version of Colortemplate is a complete rewrite of v2.2.3 and uses a different template syntax that is not fully backward compatible.

    • To use the old syntax, check out the v2 branch of the repository.
    • To update existing templates to the new syntax, use the command :help colortemplate-migrate-v2 within Vim.