Adding color with colorizer and rainbow

From EdWiki

Revision as of 14:30, 23 February 2021 by Jshankar (Talk | contribs) (=)

Install colorizer

Plug 'norcalli/nvim-colorizer.lua'


Create a place for lua plugins

mkdir ~/.config/nvim/lua
touch ~/.config/nvim/lua/plug-colorizer.lua

Add the following:

    RGB      = true;         -- #RGB hex codes
      RRGGBB   = true;         -- #RRGGBB hex codes
      names    = true;         -- "Name" codes like Blue
      RRGGBBAA = true;         -- #RRGGBBAA hex codes
      rgb_fn   = true;         -- CSS rgb() and rgba() functions
      hsl_fn   = true;         -- CSS hsl() and hsla() functions
      css      = true;         -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
      css_fn   = true;         -- Enable all CSS *functions*: rgb_fn, hsl_fn

Remember to source in init.vim, but a little differently this time

lua require'plug-colorizer'


This will not work if the file doesn't have and extension i.e. .txt .py. js .css

If you want to enable it you can do so like this:


Cool Note

You can increment and decrement in vim with c-a and c-x

just hover over a number in normal mode

r also work great

Lua Note

Install luarocks if you want to use with coc-lua


Enter the following to see what happens

rgb(113, 146, 230)
rgb(7%, 77%, 46%)

=== Checkout the repo ===
[ colorizer]

=== Install Rainbow ===

 Plug 'junegunn/rainbow_parentheses.vim'

=== Configuration ===
let g:rainbow#max_level = 16
let g:rainbow#pairs = [['(', ')'], ['[', ']'], ['{', '}']]
autocmd FileType * RainbowParentheses