A powerful plugin that lets Neovim Users choose & modify colors. This plugin supports RGB, HSL and HEX colors.
You can watch the full demo of the plugin here: Color Picker for Neovim! - color-picker.nvim Plugin Showcase
Transparency Slider & Numeric Input Update: Transparency Slider Support! - color-picker.nvim Development Update
Neovim 0.7 or higher.
For Packer
use ({"ziontee113/color-picker.nvim",
config = function()
require("color-picker")
end,
})For vim-plug
Plug 'ziontee113/color-picker.nvim'
-- Initialize the plugin
require('color-picker').setup()local opts = { noremap = true, silent = true }
vim.keymap.set("n", "<C-c>", "<cmd>PickColor<cr>", opts)
vim.keymap.set("i", "<C-c>", "<cmd>PickColorInsert<cr>", opts)
-- vim.keymap.set("n", "your_keymap", "<cmd>ConvertHEXandRGB<cr>", opts)
-- vim.keymap.set("n", "your_keymap", "<cmd>ConvertHEXandHSL<cr>", opts)
require("color-picker").setup({ -- for changing icons & mappings
-- ["icons"] = { "ﱢ", "" },
-- ["icons"] = { "ﮊ", "" },
-- ["icons"] = { "", "ﰕ" },
-- ["icons"] = { "", "" },
-- ["icons"] = { "", "" },
["icons"] = { "ﱢ", "" },
["border"] = "rounded", -- none | single | double | rounded | solid | shadow
["keymap"] = { -- mapping example:
["U"] = "<Plug>ColorPickerSlider5Decrease",
["O"] = "<Plug>ColorPickerSlider5Increase",
},
["background_highlight_group"] = "Normal", -- default
["border_highlight_group"] = "FloatBorder", -- default
["text_highlight_group"] = "Normal", --default
})
vim.cmd([[hi FloatBorder guibg=NONE]]) -- if you don't want weird border background colors around the popup.By default:
-
handlwill increment the color slider value by 1. -
uandi/aandd/AandDwill increment the color slider value by 5. -
sandw/SandWwill increment the color slider value by 10. -
owill change your color output -
Number
0to9will set the slider at your cursor to certain percentages.0sets to 0%,9sets to 90%,5sets to 50%. -
Hsets to 0%,Msets to 50%,Lsets to 100%.
By default:
- If your slider is on the
4thline (the same line as the color output preview), when you increment / set a color value, it will apply that change to all 3 sliders above it. guwill select the 1st and 2nd sliders,gdwill select the 2nd and 3rd sliders,gmwill select the 1st and 3rd sliders.- Press
xwill deselect the slider group.
- If you press
n, you can press number keys to input the color value manually for individual sliders or slider group. If you press any key that is not a number key, it will execute that key as normal. - For example: if you want to input 15 on the 1st slider: move your cursor to the 1st slider, press
nthen press15. Then you can presskto move on to the next slider. The slider values will update as you type out the numbers.
- When your cursor is on a corlor, use
:PickColorto open up the picker, then pressoto change the output type toRGB/HEX/HSL. PressEnterand the color under your cursor will be converted.
- Press
tto toggle Transparency Slider. While this mode is active, you will only be able to output the color asrgba()orhsla(). If you want to output asHEX, presstto get out of Transparency Mode, and you'll be able to pressoto output your color asHEX.
Click this Dropdown to see Available Commands
<Plug>ColorPickerSlider10Decrease
<Plug>ColorPickerSlider10Increase
<Plug>ColorPickerSlider5Decrease
<Plug>ColorPickerSlider5Increase
<Plug>ColorPickerSlider1Decrease
<Plug>ColorPickerSlider1Increase
<Plug>ColorPickerSlider0Percent
<Plug>ColorPickerSlider10Percent
<Plug>ColorPickerSlider20Percent
<Plug>ColorPickerSlider30Percent
<Plug>ColorPickerSlider40Percent
<Plug>ColorPickerSlider50Percent
<Plug>ColorPickerSlider60Percent
<Plug>ColorPickerSlider70Percent
<Plug>ColorPickerSlider80Percent
<Plug>ColorPickerSlider90Percent
<Plug>ColorPickerSlider100Percent
<Plug>ColorPickerSetActionGroup1and2
<Plug>ColorPickerSetActionGroup2and3
<Plug>ColorPickerSetActionGroup123
<Plug>ColorPickerSetActionGroup1and3
<Plug>ColorPickerClearActionGroup
<Plug>ColorPickerChangeOutputType
<Plug>ColorPickerChangeColorMode
<Plug>ColorPickerApplyColor
<Plug>ColorPickerToggleTransparency
<Plug>ColorPickerNumericInput
If you run into issues or come up with an awesome idea, please feel free to open an issue or PR.
The project is licensed under MIT license. See LICENSE file for details.