Skip to content
Simple color selector/picker plugin for Vim.
Vim script Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Update to v1.2.2: Update doc & README Jun 3, 2015
pickers Do not output anything if user cancels on OS X. Oct 3, 2018
plugin fix zenity color picker Feb 25, 2017

vCoolor - Simple color selector/picker for Vim (v1.2.3)


vCoolor is a Vim plugin that allows using a color picker/selector directly from the editor.

What this plugin do:

  • Insert hex, rgb, rgba (With 1 in opacity) or hsl color anywhere.
  • Modify hex color even if there are many colors in 1 line.
  • Modify a rgb color with 0-255 values or % (Only one by line).
  • Modify a rgba color but don't change the opacity (Only one by line).
  • Modify a hsl color (Only one by line).

What this plugin doesn't do:

  • Insert or modify hsla colors.

In GNU/Linux it uses a simple GTK+ dialog via Zenity or Yad.


In windows it uses colorpicker-windows-commandline (The binary is included in the plugin).


In Mac OSX it uses a ruby script to trigger the system color picker.


And if you want, you can even use your own color picker.


To use vCoolor in GNU/Linux, you need to have Zenity (Included in most distributions) or Yad (If you compile it manually, do it with GTK2 to avoid problem #1).

Manual installation

Install the distributed files into Vim runtime directory which is usually ~/.vim/, or $HOME/vimfiles on Windows.

Using Pathogen

If you're using pathogen, extract the files into bundle directory.

Using a plugin manager

And this is the recommended way, use a vim plugin manager:

Plugin manager In vimrc Installation command
Vim-plug Plug 'KabbAmine/vCoolor.vim' PlugInstall
Vundle Plugin 'KabbAmine/vCoolor.vim' PluginInstall
NeoBundle NeoBundle 'KabbAmine/vCoolor.vim' NeoBundleInstall


In both NORMAL and INSERT modes, only 1 shortcut is needed: <Alt-C> (I find it very convenient 😄), but he may be not working on terminal.

Use it:

  • To insert a color anywhere.
  • To modify the current hex, rgb, rgba or hsl color.

And using:

  • <Alt-R> you can insert a rgb color anywhere (NORMAL and INSERT modes).
  • <Alt-V> you can insert a hsl color anywhere (NORMAL and INSERT modes).
  • <Alt-W> you can insert a rgba color anywhere (NORMAL and INSERT modes).

Click on the image for a short screencast of the v0.1.

Screencast of vCoolor


You can execute vCoolor with:

:VCoolIns r		" For rgb color insertion
:VCoolIns h		" For hsl color insertion
:VCoolIns ra	" For rgba color insertion

You can toggle between lower/upper case for the returned hex color with:


Also, I've used some color conversion commands for debug purpose but I finally decided to keep them in the plugin, they may be useful.

Here they are with exemples to understand how they work:

:Rgb2Hex "255, 0, 255"			" Gives "#FF00FF"
:Rgb2RgbPerc "255, 0, 255"		" Gives "100%, 0%, 100%"
:Rgb2Hsl "255, 0, 255"			" Gives "300, 100%, 50%"

:RgbPerc2Hex "100%, 0%, 100%" " Gives "#FF00FF"
:RgbPerc2Rgb "100%, 0%, 100%" " Gives "255, 0, 255"

:Hex2Lit "#FF00FF"				" Gives "magenta"
:Hex2Rgb "#FF00FF"				" Gives "255, 0, 255"
:Hex2RgbPerc "#FF00FF"			" Gives "100%, 0%, 100%"
:Hex2Hsl "#FF00FF"				" Gives "300, 100%, 50%"

:Hsl2Rgb "300, 100%, 50%"		" Gives "255, 0, 255"
:Hsl2Hex "300, 100%, 50%"		" Gives "#FF00FF"


To change the mapping by default, add to your vimrc.

let g:vcoolor_map = '<NEW_MAPPING>'
let g:vcool_ins_rgb_map = '<NEW_MAPPING>'		" Insert rgb color.
let g:vcool_ins_hsl_map = '<NEW_MAPPING>'		" Insert hsl color.
let g:vcool_ins_rgba_map = '<NEW_MAPPING>'		" Insert rgba color.

Each mapping works in both NORMAL and INSERT mode (You can disable all of them if you want).


Hex colors in lowercase

To get hex colors in lower case by default, add to your vimrc:

let g:vcoolor_lowercase = 1

Disable default mappings

To disable all default mappings and map only what you want:

let g:vcoolor_disable_mappings = 1

Define a custom color picker

Any color picker who take/return a hexcolor in standard I/O can be defined as the one used in the plugin:

let g:vcoolor_custom_picker = 'path/to/picker --option '

As an example with zenity in GNU/Linux:

let g:vcoolor_custom_picker = 'zenity --title "custom" --color-selection --show-palette --color '

Please note that the hex color will be added in the end of the string above, so add a space if needed.

Example of configuration

let g:vcoolor_lowercase = 1
let g:vcoolor_disable_mappings = 1
let g:vcoolor_map = '<leader>g'


  • A better regex patterns.
  • Handle rgba colors.
  • Handle hsla colors.
  • Add possibility to modify 2 or more rgb colors in a line.
  • Option to abbreviate colors.


To Yad's author.

To Bram Moolenaar for creating the best piece of software in the world :D

To Jonathan Warner alias jaxbot for his contribution.

To you if you're using vCoolor.

You can’t perform that action at this time.