sponsor Vim development Vim logo Vim Book Ad

colorizer : Highlight #rrggbb or #rgb color

 script karma  Rating 173/63, Downloaded by 4012  Comments, bugs, improvements  Vim wiki

created by
script type
A modification of css_color.vim (vimscript #2150). It highlights all color strings in the form of #rrggbb or #rgb, regardless of file types, and unlike css_color.vim, it's able to find all colors in one line. It has support for 256-color terminals. It won't highlight color names.

This plugin defines three commands:

ColorHighlight - start/update highlighting
ColorClear      - clear all highlights
ColorToggle     - toggle highlights

By default, <leader>tc is mapped to ColorToggle. If you want to use another
key map, do like this:
nmap ,tc <Plug>Colorizer

If you want completely not to map it, set the following in your vimrc:
      let g:colorizer_nomap = 1

To use solid color highlight, set this in your vimrc (later change won't
probably take effect unless you use ':ColorHighlight!' to force update):
      let g:colorizer_fgcontrast = -1
set it to 0 or 1 to use a softened foregroud color.

Note: if you modify a color string in normal mode, if the cursor is still on
that line, it'll take 'updatetime' seconds to update. You can use
:ColorHighlight (or your key mapping) again to force update.

Performace Notice: In terminal, it may take several seconds to highlight 240
different colors. GUI version is much quicker.

* on github https://github.com/lilydjwg/colorizer
* 中文介绍(非官方) Chinese introduction (unoffical)
** http://www.gracecode.com/archives/3071/

Similar plugin:
* hexHighlight.vim vimscript #2937
install details
extract the tarball to ~/.vim (or for windows, $VIM/vimfiles)

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
colorizer.tar.gz 1.4.2 2016-02-21 7.0 lilydjwg add support for #rrggbbaa and #aarrggbb (switchable)
colorizer.tar.gz 1.4.1 2014-01-25 7.0 lilydjwg * fixed auto-startup regression (thanks to shanesmith)
colorizer.tar.gz 1.4 2014-01-17 7.0 lilydjwg * improved performance and minimized startup time, thanks to blueyed
* use TextChanged* events if availlable
* other minor changes
colorizer.vim 1.3.1 2011-05-10 7.0 lilydjwg ColorToggle works again (after 1.3)
colorizer.vim 1.3 2011-05-09 7.0 lilydjwg * remain highlight when colorscheme changed
* update highlighting when BufRead
* add g:colorizer_fgcontrast to change foreground color (now it can highlight the color code to a solid block like hexHighlight.vim does)
Thanks to Ingo Karkat and rykka.
colorizer.vim 1.2.1 2011-05-06 7.0 lilydjwg fix variable undefined error.
colorizer.vim 1.1 2011-05-04 7.0 lilydjwg Use commands to invoke;
Add :ColorClear;
Support for #rgb form;
Other improvements.
Thanks to Ingo Karkat.
colorizer.vim 1.0 2011-04-28 7.0 lilydjwg Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
OSDN.net Logo