Home

Awesome

color-picker.nvim

A powerful plugin that lets Neovim Users choose & modify colors. This plugin supports RGB, HSL and HEX colors.

color picker 1v2

Usage:

You can watch the full demo of the plugin here: Color Picker for Neovim! - color-picker.nvim Plugin Showcase

color picker 2

Transparency Slider & Numeric Input Update: Transparency Slider Support! - color-picker.nvim Development Update

Requirements:

Neovim 0.7 or higher.

Installation:

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()

Set Things Up:

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.

Features & Default Keymaps:

Picking Colors:

By default:

Multiple Sliders:

By default:

Manual Numeric Input:

Converting Colors (RGB/HEX/HSL)

Transparency Mode

Available Commands:

<details> <summary>Click this Dropdown to see Available Commands</summary>
<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

</details>

Feedback

If you run into issues or come up with an awesome idea, please feel free to open an issue or PR.

License

The project is licensed under MIT license. See LICENSE file for details.

Credits

@max397574 for creating https://github.com/max397574/colortils.nvim.

@lars-vc for adding HEX transparency features #17

@Tired-Fox for adding shorthand HEX recognition #21