sponsor Vim development Vim logo Vim Book Ad

Colorizer : highlight color codes and names

 script karma  Rating 231/84, Downloaded by 8413  Comments, bugs, improvements  Vim wiki

created by
Christian Brabandt
 
script type
ftplugin
 
description
This plugin is based on the css_color plugin by Nikolaus Hofer. The idea is to highlight color names and codes in the same color that they represent.

The plugin understands the W3-Colors (used for CSS files for example), the Color names from the X11 Window System and also codes in hex notation, like #FF0000 (which represents Red in the RGB color system). Additionally, it supports the CSS color specifications, e.g. rgb(RR,GG,BB) color representation in either absolutely values or as percentage and also the HVL Color representation like hvl(H,V,L)

It works best in the gui version of Vim, but the plugin also supports 256 and 88 color terminals and translates the colors to those supported by the terminal. 16 and 8 color terminals should work theoretically too, but hasn't been widely tested. Note, that translating the colors to the terminal might impose a performance penalty, depending on the terminal type and the number of matches in the file.

Screenshot: http://www.256bit.org/~chrisbra/Colorizer.png
 
install details
1) open the .vmb file with Vim
2) source the file (:so %)
3) restart Vim
4) read the help at :h Colorizer
 

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-0.10.vmb 10 2014-03-27 7.3 Christian Brabandt - Also highlight Ansi Term sequences
- Match colornames using the "old" RE Engine, if Vim supports it.
- Make |:RGB2Xterm| output the color name in its color
- Rename |:RGB2Xterm| to |:RGB2Term|
- Highlight Taskwarrior file
- Code refactoring
- Make |:ColorSwapFgBg| work as expected (did not always toggle reliably
  between all states)
- Correctly parse Ansi Term colors
- |:Term2RGB|
- Highlight Vim color files correctly
- merge colorhighlight plugin https://github.com/blueyed/colorhighlight.vim
(automatically
uploaded)
Colorizer-0.9.vmb 9 2013-08-14 7.3 Christian Brabandt - https://github.com/chrisbra/color_highlight/issues/15 (rgba highlighting
  didn't work for floating point value of alpha, reported by LiTuX.S, thanks!)
- https://github.com/chrisbra/color_highlight/issues/16 (rgb() pattern did
  match too much, reported by taecilla, thanks!)
- https://github.com/chrisbra/color_highlight/issues/19 (error on calling
  ColorWinEnter() command, reported by wedgwood, thanks!)
- https://github.com/chrisbra/color_highlight/issues/20 and
  https://github.com/chrisbra/color_highlight/issues/21
  (also
color on split commands, reported by wedgwood and Andri Möll, Thanks!)
- https://github.com/chrisbra/color_highlight/issues/22 (Make sure, patterns
  like white-space won't get colored, reported by Andri Möll, Thanks!)
- https://github.com/chrisbra/color_highlight/issues/23 (ColorToggle got
  confused when several windows with highlighting exists, reported by Andri
  Möll, Thanks!)
- https://github.com/chrisbra/color_highlight/issues/24 (turning off coloring
  should also remove the autocommands, reported by Andri Möll, Thanks!)
(automatically uploaded)
Colorizer-0.8.vmb 8 2012-12-14 7.3 Christian Brabandt - https://github.com/chrisbra/color_highlight/issues/13 (colorizing should not
  stop at word-boundaries, reported by teschmitz, thanks!)
- https://github.com/chrisbra/color_highlight/issues/14 (convert highlighting
  to syntax groups, so TOhtml works, reported by teschmitz, thanks!)
(automatically uploaded)
Colorizer-0.7.vmb 7 2012-07-25 7.3 Christian Brabandt - Highlight rgb colors with whitespace after comma (reported by sergey-vlasov
  in https://github.com/chrisbra/color_highlight/issues/12, thanks!)
- Save and restore the search register, so the plugin doesn't clobber it
- check for 'ed' and 'gd' defaults
(automatically uploaded)
Colorizer-0.6.vmb 6 2012-05-17 7.3 Christian Brabandt - Fix various issues with hsl coloring (reported by teschmitz in https://github.com/chrisbra/color_highlight/issues/9, thanks!)
- Make it possible, to skip coloring comments (reported by teschmitz in https://github.com/chrisbra/color_highlight/issues/10, thanks!)
- search highlighting should overrule color highlighting(reported by teschmitz in https://github.com/chrisbra/color_highlight/issues/11, thanks!)
- updated documentation (suggested by teschmitz, thanks!)
(automatically uploaded)
Colorizer-0.5.vmb 5 2012-04-03 7.3 Christian Brabandt Fix issue 7 (reported by teschmitz in https://github.com/chrisbra/color_highlight/issues/7, thanks!)
(automatically uploaded)
Colorizer-0.4.vmb 4 2012-03-23 7.3 Christian Brabandt - |:ColorSwapFgBg| (suggested by teschmitz, in https://github.com/chrisbra/color_highlight/issues/3, thanks!)
- make automatic color loading work (reported by wedgwood in https://github.com/chrisbra/color_highlight/issues/6, thanks!) |Colorizer-auto| and |Colorizer-hl-ft|
- more documentation updates
- added Mappings (suggested by Ingo Karkat, thanks!) |Colorizer-maps|
- prevent highlighting of color names (suggested by Tarlika Schmitz in https://github.com/chrisbra/color_highlight/issues/5, thanks!) |Colorizer-hl-names|
- enable filetype specific autocommands, so that for certain filetypes colors are highlighted automatically |Colorizer-hl-ft| (suggested by Tarlika Schmitz, thanks!)
(automatically uploaded)
color_highlight-0.3.vmb 3 2012-03-15 7.3 Christian Brabandt - Use the g:colorizer_fgcontrast variable to have lesser contrast between foreground and background colors (patch by Ingo Karkat, thanks!)
- gvim did not color rgb(...) codes
- did not correctly highlight 3 letter color codes (issue https://github.com/chrisbra/color_highlight/issues/1, reported by Taybin Rutkin, thanks!)
- support autoloading (requested by Ingo Karkat, thanks!)
- add |GLVS| support
- |:ColorContrast| to interactively switch between contrast settings (suggested by Ingo Karkat, thanks!)
(automatically uploaded)
color_highlight-0.2.vmb 0.2 2012-03-09 7.3 Christian Brabandt Initial upload
ip used for rating: 142.132.191.50

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.
   
Vim at Github