Skip to content

A simple utility to precompile your current theme to increase startup times

Notifications You must be signed in to change notification settings

paradoxical-dev/color-compiler.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

color-compiler.nvim

A simple utility to precompile your current theme to improve startup times

startup w/o color-compiler

color-compiler startup times

Overview

color-compiler is perfect for those who heavily modify their colorscheme, setting multiple custom overrides of highlight groups.

If this is you, you know that doing this comes with a price... valuable milliseconds

The goal of this plugin is to precompile your current theme to avoid the tax in startup times.

Although this feature is packaged in popular themes, such as catppuccin or kanagawa, this project allows any custom confiuration to be compiled and saved for later use.

The code has been heavily based off of catppuccin's implementation and adapted to work with any currently set colorscheme

Installation

-- lazy
return {
  {
    "paradoxical-dev/color-compiler.nvim",
    lazy = false,
    priority = 1000
    opts = {
      -- Check 'Usage' section
    }
  }
}

Usage

Commands

ColorCompiler

The :ColorCompiler command provides the base utility for compiling your current colorscheme.

It takes 2 main arguments:

  • theme The name to save the compiled theme under (required)
  • bg The background color (if not provided the current background color will be used)

Any further arguments will be passed as group names to include in the compiled theme.

Tip

If you need to include custom groups the bg argument cannot be omitted.

Example

:ColorCompiler my_theme dark FzfNormal AlphaHeader

Simply have your theme setup to how you like and run the command. The compiled theme will then be saved to the default save location in ~/.local/share/nvim/color-compiler/ under the passed in theme name

Setup

The main setup function is used to define the used plugins and their hl groups. See Supported Plugins for more information.

Note

The plugin includes the following extenstions by default: cmp, treesitter, lsp

The desired theme may also be passed in under the theme key but will return an error if no file is present with this name.

Example

opts = {
  extenstions = {
    "harpoon",
    "telescope",
    -- ...
  }
  theme = "my_theme"
}

Supported Plugins

Add the corresponding Extension Name to the extenstions key when calling the setup function.

Plugin Extension Name
aerial "aerial"
cmp "cmp"
dap/dap-ui "dap"
flash.nvim "flash"
vim-flog "flog"
fzf "fzf"
gitsigns "gitsigns"
harpoon "harpoon"
Heirline "heirline"
illiminate "illiminate"
lazy "lazy"
LSP "lsp"
markview "markview"
mason "mason"
neotest "neotest"
neo-tree "neo-tree"
noice "noice"
NormalNvim "normalnvim"
render-markdown "render-md"
Semantic Highlights "semantics"
snacks "snacks"
telescope "telescope"
treesitter "treesitter"
ufo "ufo"
which-key "which-key"

Note

If a plugin you use is not supported and adding the custom groups to the command is too cumbersome, consider forking and creating a pull request.

Simply update the extenstions list with the desired plugin and corresponding groups and I will approve the PR asap

About

A simple utility to precompile your current theme to increase startup times

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages