ziontee113 / color-picker.nvim

A powerful Neovim plugin that lets users choose & modify RGB/HSL/HEX colors.
MIT License
281 stars 8 forks source link
color color-picker lua neovim

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:

Click this Dropdown to see Available Commands ``` ColorPickerSlider10Decrease ColorPickerSlider10Increase ColorPickerSlider5Decrease ColorPickerSlider5Increase ColorPickerSlider1Decrease ColorPickerSlider1Increase ColorPickerSlider0Percent ColorPickerSlider10Percent ColorPickerSlider20Percent ColorPickerSlider30Percent ColorPickerSlider40Percent ColorPickerSlider50Percent ColorPickerSlider60Percent ColorPickerSlider70Percent ColorPickerSlider80Percent ColorPickerSlider90Percent ColorPickerSlider100Percent ColorPickerSetActionGroup1and2 ColorPickerSetActionGroup2and3 ColorPickerSetActionGroup123 ColorPickerSetActionGroup1and3 ColorPickerClearActionGroup ColorPickerChangeOutputType ColorPickerChangeColorMode ColorPickerApplyColor ColorPickerToggleTransparency ColorPickerNumericInput ```

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