Vim plugin for converting between common color formats.
Note: alpha! I'm still working out a good API for this plugin, so for the time being, it's fairly raw, just exposing a handful of low level functions for manually converting text values. Down the road, I picture some out-of-the-box mappings, as well as more conversion offerings, to make the experience more pleasant. Until then, expect to set up your own mappings for these functions.
Via Pathogen
cd ~/.vim/bundle
git clone git://github.com/jimf/vim-color-convert
color_convert.vim exposes the following functions for converting one color value to another:
color_convert#hex2rgb(hex_string)
- Input: Hex color value (e.g., "#fff", "#C0FFEE", etc.)
- Output: RGB color value (e.g., "rgb(255, 255, 255)")
- Example:
:echo color_convert#hex2rgb('#000')
color_convert#rgb2hex(rgb_string)
- Input: RGB color value (e.g., "rgb(255, 255, 255)")
- Output: RGB color value (e.g., "#ffffff")
- Example:
:echo color_convert#rgb2hex('rgb(0, 0, 0)')
Convert visually selected text from one color format to another:
vnoremap <leader>r c<C-R>=color_convert#hex2rgb('<C-R>"')<CR><ESC>
vnoremap <leader>h c<C-R>=color_convert#rgb2hex('<C-R>"')<CR><ESC>
MIT