*Colorizer.txt* A plugin to color colornames and codes
Author: Christian Brabandt <cb@256bit.org>
Version: 0.6 Thu, 17 May 2012 21:03:52 +0200
Copyright: (c) 2009, 2010, 2011, 2012 by Christian Brabandt
The VIM LICENSE applies to Colorizer.txt
(see |copyright|) except use NrrwRgnPlugin instead of "Vim".
NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK.
==============================================================================
Contents *Colorizer*
==============================================================================
1. Colorizer Manual.............................|Colorizer-manual|
1.1 :ColorHighlight......................|:ColorHighlight|
1.2 :ColorClear..........................|:ColorClear|
1.3 :RGB2Xterm...........................|:RGB2Xterm|
1.4 :HSL2RGB.............................|:HSL2RGB|
1.5 :ColorContrast.......................|:ColorContrast|
1.6 :ColorSwapFgBg.......................|:ColorSwapFgBg|
2. Configuration................................|Colorizer-config|
2.1 Automatic loading....................|Colorizer-auto|
2.2 Automatically highlight filetypes....|Colorizer-hl-ft|
2.3 Skip coloring comments...............|Colorizer-comments|
2.4 Adjust the contrast..................|Colorizer-contrast|
2.5 Highlight colornames.................|Colorizer-hl-names|
2.6 Use X11 colornames...................|Colorizer-names|
3. Colorizer Mappings...........................|Colorizer-maps|
4. Colorizer Tips...............................|Colorizer-tips|
5. Colorizer Feedback...........................|Colorizer-feedback|
6. Colorizer History............................|Colorizer-history|
==============================================================================
1. Colorizer Manual *Colorizer-manual*
==============================================================================
Functionality
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 absolute or percentage values 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.
This plugin defines the following commands:
*:ColorHighlight*
:[range]ColorHighlight[!] Scan the lines given by [range] for color codes
names and highlight those. If [range] is omitted,
the whole file will be scanned. If the ! is used,
the plugin will redefine all highlighting groups.
*:ColorClear*
:ColorClear Turn off Color highlighting.
*:RGB2Xterm*
:RGB2Xterm <color> Translate the color code given as argument to a
the closest color, that can be displayed by the
terminal. Note, the color must be given in the
format #RRGGBB (the hex format of the colors reg,
green and blue the '#' is optional or
alternatively like rgb(X,X,X)
Uses the number of colors your terminal is capable
to handle (or 256 colors for gVim).
*:HSL2RGB*
:HSL2RGB hsl(h,v,l) Translate the HVL color defined by the string
'hsl(h,v%,l%)' into a color that the current
terminal can display. Note, that the color must be
given in the format 'hsl(HH, V, L)' where HH
defines the Hue as absolute value between 0 and
255 and V and L represent a percentage for value
and Lightness.
*:ColorContrast*
:ColorContrast Switch between all different color contrast
settings.
*:ColorSwapFgBg*
:ColorSwapFgBg Switch between foreground and background colors.
This will toggle in 3 ways. From Swapping
foreground and background colors, to only
highlight the foreground color back to normal
forground background color.
==============================================================================
2 Colorizer Configuration *Colorizer-config*
==============================================================================
2.1 Automatic loading *Colorizer-auto*
---------------------
The Colorizer plugin can be configured to automatically load when opening a
new file. Note, that this might slow down the loading process, especially on
the terminal. To enable this, simply the the variable 'g:colorizer_auto_color'
to 1, e.g. by defining it in your |.vimrc| >
<
(Not recommended, see below at |Colorizer-hl-ft| for the prefered way)
2.2 Automatically highlight filetypes *Colorizer-hl-ft*
-------------------------------------
If you want to have certain filetypes automaticaly highlighted, you can use
the variable g:colorizer_auto_filetype, e.g. say you want to enable color
highlighting for html and CSS files, put into your |.vimrc| the following: >
<
After restarting Vim, the plugin will become active, whenever the filetype is
set to either html or css.
2.3 Skip coloring comments *Colorizer-comments*
--------------------------
You can skip comments from coloring, by setting the variable
g:colorizer_skip_comments to 1, e.g. put into your |.vimrc| the following: >
<
The plugin will skip all matches of color codes and names, that appear inside
comments (only works, when syntax highlighting is enabled |:syn-on|)
Note however, that if the same color is used inside comments and outside
comments, it will also be highlighted inside the comments, because
coloring is done matching only the color pattern and once this is done outside
of comments, this will also match inside comments.
2.4 Adjust the contrast *Colorizer-contrast*
-----------------------
Colorizer can be adjusted to blur the contrast between foreground and
background color. For this, the variable 'g:colorizer_fgcontrast' can be used.
It can be given any value between -1 and 2 with 2 being the default. Each
smaller value will decrease the contrast a little bit, with -1 being special,
as there is the foreground color equals the background color. Use
|:ColorContrast| to toggle the different values.
2.5 Highlight colornames *Colorizer-hl-names*
------------------------
If for any reason you don't want the plugin to highlight colornames, you can
prevent this by setting the g:colorizer_colornames variable to 0, e.g. put >
<
into your |.vimrc|
2.6 Use X11 colornames *Colorizer-names*
----------------------
Colorizer can be configured to support all color names, defined by the X11
Window System. By default it only supports the colors defined by the W3C for
the CSS Specification. To use the X11 color names, set the variable
'g:colorzer_x11_names' to 1, e,g. put in your |.vimrc| >
<
==============================================================================
3. Colorizer Mappings *Colorizer-maps*
==============================================================================
Besides using the commands provided at |Colorizer-manual| the plugin also sets
up some keymappings. It uses the prefix <leader>c to set all functionality up.
These mappings are provided:
Keys Name Function
---- ---- --------
<Leader>cC <Plug>Colorizer Toggle Highlighting of Colors, in visual
mode, only highlights the colors in the
selected region (normal and visual mode).
<Leader>cT <Plug>ColorContrast Toggle contrast setting |:ColorContrast|
(normal and visual mode)
<Leader>cF <Plug>ColorFgBg Toggle Foreground and Background Color
|:ColorSwapFgBg|
By default, <Leader> is defined as '\' (|<Leader>|). Use the name provided in
the second column to map the function to a different key.
==============================================================================
4. Colorizer Tips *Colorizer-tips*
==============================================================================
You can enable the plugin to be loaded for certain filetypes automatically.
This makes sense for example for CSS files or HTML files. To do so, create the
following autocommand in your |.vimrc| >
<
This will automatically highlight all existing color codes and names if you
edit either a html file or a css file. Note, that this does not update the
highlighting, after you have been updating the file.
The better way to do this, is to use the g:colorizer_auto_filetype
variable and set this to the desired filetypes. |Colorizer-hl-ft|
==============================================================================
5. Colorizer Feedback *Colorizer-feedback*
==============================================================================
Feedback is always welcome. If you like the plugin, please rate it at the
vim-page: http://www.vim.org/scripts/script.php?script_id=3963
You can also follow the development of the plugin at github:
http://github.com/chrisbra/color_highlight
Bugs can also be reported there:
https://github.com/chrisbra/color_highlight/issues
Alternatively, you can also report any bugs to the maintainer, mentioned in the
third line of this document. Please don't hesitate to contact me, I won't bite
;)
If you like the plugin, write me an email (look in the third line for my mail
address). And if you are really happy, vote for the plugin and consider
looking at my Amazon whishlist: http://www.amazon.de/wishlist/2BKAHE8J7Z6UW
==============================================================================
6. Colorizer History *Colorizer-history*
==============================================================================
+ - +-- 9 Zeilen: 0.6: May 17, 2012
0.6: May 17, 2012 {{{1
| - 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!)
|
+ - +-- 3 Zeilen: 0.5: Apr 03, 2012
0.5: Apr 03, 2012 {{{1
| - Fix issue 7 (reported by teschmitz in
| https://github.com/chrisbra/color_highlight/issues/7, thanks!)
+ - +-- 15 Zeilen: 0.4: Mar, 23, 2012
0.4: Mar, 23, 2012 {{{1
| - |: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!)
|
+ - +-- 11 Zeilen: 0.3: Mar 15, 2012
0.3: Mar 15, 2012 {{{1
| - 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!)
+ - +-- 7 Zeilen: 0.2: Mar 02, 2012
0.2: Mar 02, 2012 {{{1
|
| - Initial upload
| - development versions are available at the github repository
| - put plugin on a public repository
| (http://github.com/chrisbra/color_highlight)
|
+ - +-- 3 Zeilen: 0.1: Mar 02, 2012
0.1: Mar 02, 2012 {{{1
| - first internal version
| }}}
==============================================================================
Modeline:
vim:tw=78:ts=8:ft=help:et:fdm=marker:fdl=0:norl