{"id":31333342,"url":"https://github.com/immanuelhaffner/pigmentor.nvim","last_synced_at":"2025-09-26T01:52:35.330Z","repository":{"id":311003189,"uuid":"1041567768","full_name":"ImmanuelHaffner/pigmentor.nvim","owner":"ImmanuelHaffner","description":"Your mentor to dealing with pigments (colors) in Neovim","archived":false,"fork":false,"pushed_at":"2025-09-05T13:28:05.000Z","size":2288,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-05T15:31:43.867Z","etag":null,"topics":["neovim","neovim-plugin","vim"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ImmanuelHaffner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-20T17:18:49.000Z","updated_at":"2025-09-05T13:26:34.000Z","dependencies_parsed_at":"2025-08-28T22:07:48.492Z","dependency_job_id":null,"html_url":"https://github.com/ImmanuelHaffner/pigmentor.nvim","commit_stats":null,"previous_names":["immanuelhaffner/pigmentor.nvim"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ImmanuelHaffner/pigmentor.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImmanuelHaffner%2Fpigmentor.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImmanuelHaffner%2Fpigmentor.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImmanuelHaffner%2Fpigmentor.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImmanuelHaffner%2Fpigmentor.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ImmanuelHaffner","download_url":"https://codeload.github.com/ImmanuelHaffner/pigmentor.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ImmanuelHaffner%2Fpigmentor.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277009875,"owners_count":25744543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neovim","neovim-plugin","vim"],"created_at":"2025-09-26T01:52:31.790Z","updated_at":"2025-09-26T01:52:35.325Z","avatar_url":"https://github.com/ImmanuelHaffner.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- vim: set tabstop=2 shiftwidth=2: --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e\u003cimg src=\"img/pigmentor.png\" style=\"height: 1.2em; width: auto; vertical-align: middle; border-radius: 15%;\"/\u003e pigmentor.nvim\u003c/h1\u003e\n  \u003cp\u003e\n    \u003cstrong\u003eYour mentor for dealing with pigments (colors) in Neovim\u003c/strong\u003e\n  \u003c/p\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/neovim/neovim/releases/tag/v0.9.0\"\u003e\u003cimg src=\"https://img.shields.io/badge/Neovim-0.9.0+-green.svg?style=flat-square\u0026logo=Neovim\u0026logoColor=white\" alt=\"Neovim minimum version\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/ImmanuelHaffner/pigmentor.nvim/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/ImmanuelHaffner/pigmentor.nvim?style=flat-square\u0026logo=MIT\u0026logoColor=white\" alt=\"MIT License\"/\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n**Pigmentor** is a Neovim plugin that intelligently highlights color values in your code with their actual colors. Whether you're working with CSS, LaTeX, or any code containing color values, Pigmentor visualizes them directly in your editor.\n\n## ✨ Features\n\n- 🎯 **Smart Color Detection**: Automatically finds and highlights various color formats\n- 🎨 **Multiple Display Styles**: Choose between inline, highlight, or hybrid visualization modes\n- 🔄 **Real-time Updates**: Colors update as you type and move your cursor\n- 🎛️ **Mode-aware**: Different behavior for normal, insert, visual, and operator-pending modes\n- 🖥️ **Window Management**: Smart handling of active/inactive windows\n- ⚡ **Performance Optimized**: Only processes visible content for smooth editing\n\n### Supported Color Formats\n\n- **Hexadecimal**: `#FF0000`, `#F00`, `#FF0000AA`\n- **CSS RGB/RGBA**: `rgb(255, 0, 0)`, `rgba(255, 0, 0, 0.5)`\n- **CSS HSL/HSLA**: `hsl(200, 1, .6)`, `hsla(200deg, 100%, 60.0%)`\n- **LaTeX Colors**: `\\definecolor{red}{RGB}{255,0,0}`, `\\definecolor{blue}{HTML}{0000FF}`\n\n### Examples\n\n![](img/demo_inline_simple_dot_post.png)\n![](img/demo_inline_tulip_inverted.png)\n![](img/demo_highlight_simple.png)\n![](img/demo_highlight_inverted.png)\n![](img/demo_hybrid.png)\n\n## 📦 Installation\n\nInstall using your favorite plugin manager:\n\n### [lazy.nvim](https://github.com/folke/lazy.nvim)\n\n```lua\n{\n  'ImmanuelHaffner/pigmentor.nvim',\n  config = function()\n    require'pigmentor'.setup{\n      -- your configuration here\n    }\n  end,\n}\n```\n\n### [packer.nvim](https://github.com/wbthomason/packer.nvim)\n\n```lua\nuse {\n  'ImmanuelHaffner/pigmentor.nvim',\n  config = function()\n    require'pigmentor'.setup{\n      -- your configuration here\n    }\n  end\n}\n```\n\n### [vim-plug](https://github.com/junegunn/vim-plug)\n\n```vim\nPlug 'ImmanuelHaffner/pigmentor.nvim'\n```\n\n### `vim.pack`\n\nThe plugin supports auto-loading with default configuration via `plugin/pigmentor.lua`, requiring no additional setup for basic functionality.\n\n### Try before using\n\nPigmentor provides a minimalistic Nvim configuration for demonstrational and testing purposes.\nSimply clone the repository and run `nvim --clean -u path/to/pigmentor/demo/lazy/init.lua`.\n\n## ⚙️ Configuration\n\nPigmentor comes with sensible defaults, but you can customize it to your needs.\n\n### Default Configuration\n\n```lua\nrequire'pigmentor'.setup{\n  enabled = true,                   -- whether the plugin is active\n  buftypes = {                      -- which buftypes to support\n    '',                             -- normal files\n    'help',\n    'nofile',\n    'nowrite',\n    'quickfix',\n  },\n  display = {\n    inactive = true,                -- show in inactive windows\n    style = 'inline',               -- one of 'inline', 'highlight', 'hybrid'\n    priority = 150,                 -- highlight priority, slightly above treesitter\n    inline = {\n      text_pre = nil,               -- text before color\n      text_post = '●',              -- text after color (dot indicator)\n    },\n    highlight = {\n      padding = {\n        left = 1,                   -- padding spaces on the left\n        right = 1,                  -- padding spaces on the right\n      },\n    },\n  },\n  modes = {\n    n = {                           -- normal mode\n      cursor = true,                -- show for item under cursor\n      line = true,                  -- show for current line\n      visible = true,               -- show for all visible lines\n    },\n    no = {                          -- operator-pending mode\n      cursor = false,\n      line = false,\n      visible = false,\n    },\n    i = {                           -- insert mode\n      cursor = false,\n      line = false,\n      visible = true,\n    },\n    [{ 'v', 'V', '\\x16' }] = {      -- visual modes\n      cursor = false,\n      line = false,\n      visible = false,\n    },\n  },\n}\n```\n\n### Display Styles\n\n#### Inline\n\nShows color indicators next to color values without replacing the text.\n\n![](img/example_inline_simple_dot_post.png)\n\n```lua\n{\n  display = {\n    style = 'inline',\n    inline = {\n      text_post = '●',\n    }\n  }\n}\n```\n\nYou can use multiple characters.\n\n![](img/example_inline_half_circle_post.png)\n\n```lua\n{\n  display = {\n    style = 'inline',\n    inline = {\n      text_post = '',\n    }\n  }\n}\n```\n\nYou can place characters before the text.\n\n![](img/example_inline_diamond_pre.png)\n\n```lua\n{\n  display = {\n    style = 'inline',\n    inline = {\n      text_pre = '♦',\n      text_post = nil,\n    }\n  }\n}\n```\n\nYou can provide a table of strings to `text_pre` and `text_post`.\nThe texts will be rendered consecutively with alternating inverting colors.\nWith `inverted` you configure whether to start with inverted colors.\n\n![](img/example_inline_inverted_tulip.png)\n\n```lua\n{\n  display = {\n    style = 'inline',\n    inline = {\n      inverted = true,\n      text_post = { '', '', },\n    }\n  }\n}\n```\n\n#### Highlight\n\nReplaces the foreground text color with the actual color.\n\n![](img/example_highlight_simple.png)\n\n```lua\n{\n  display = {\n    style = 'highlight',\n    highlight = {\n      inverted = false,\n      padding = {\n        left = 0,\n        right = 0,\n      }\n    }\n  }\n}\n\n```\n\nYou can swap foreground and background colors.\n\n![](img/example_highlight_inverted_with_padding.png)\n\n```lua\n{\n  display = {\n    style = 'highlight',\n    highlight = {\n      inverted = true,\n      padding = {\n        left = 1,\n        right = 1,\n      }\n    }\n  }\n}\n```\n\n\n#### Hybrid\n\nCombines both inline and highlight modes:\n\n![](img/example_hybrid_simple.png)\n\n```lua\n{\n  display = {\n    style = 'hybrid',\n    inline = {\n      text_pre = '♦',\n      text_post = nil,\n    },\n    highlight = {\n      inverted = false,\n      padding = {\n        left = 0,\n        right = 0\n      }\n    }\n  }\n}\n```\n\n![](img/example_hybrid_inverted.png)\n\n```lua\n{\n  display = {\n    style = 'hybrid',\n    inline = {\n      text_pre = '',\n      text_post = '',\n    },\n    highlight = {\n      inverted = true,\n      padding = {\n        left = 1,\n        right = 1\n      }\n    }\n  }\n}\n```\n\n## 🚀 Usage\n\nOnce installed and configured, Pigmentor works automatically.\nYou can also control it manually:\n\n```lua\nlocal pigmentor = require'pigmentor'\n\n-- Toggle the plugin on/off\npigmentor.toggle()\n\n-- Enable/disable explicitly\npigmentor.enable()\npigmentor.disable()\n\n-- Cycle through display styles\npigmentor.cycle_display_style()\n\n-- Refresh current buffer\npigmentor.refresh_buffer(vim.api.nvim_get_current_buf())\n\n-- Refresh all visible buffers\npigmentor.refresh_visible_buffers()\n```\n\n### Keymaps\n\nAdd these to your configuration for convenient access:\n\n```lua\nlocal pm = require'pigmentor'\nvim.keymap.set('n', '\u003cleader\u003ept', pm.toggle,\n  { desc = 'Toggle color highlighting' })\nvim.keymap.set('n', '\u003cleader\u003epc', pm.cycle_display_style,\n  { desc = 'Cycle color display style' })\n```\n\n### Different Styles\n\nYou can easily implement your own collection of styles and your own style cycler.\nHere's what I have in my setup of Pigmentor:\n\n```lua\nlocal display_styles = {\n    {\n        -- '#00AAFF'\n        style = 'inline',\n        inline = {\n            text_pre = '',\n            text_post = '',\n        },\n    },\n    {\n        -- '♦#00AAFF'\n        style = 'inline',\n        inline = {\n            text_pre = '♦',\n            text_post = '',\n        },\n    },\n    {\n        -- '#00AAFF' with fg text color\n        style = 'highlight',\n        highlight = {\n            padding = { left = 0, right = 0 },\n            inverted = false,\n        },\n    },\n    {\n        -- '#00AAFF' with bg color\n        style = 'highlight',\n        highlight = {\n            padding = { left = 1, right = 1 },\n            inverted = true,\n        },\n    },\n    {\n        -- '#00AAFF' with bg color\n        style = 'hybrid',\n        inline = {\n            text_pre = '',\n            text_post = '',\n        },\n        highlight = {\n            inverted = true,\n            padding = { left = 0, right = 0 },\n        },\n    },\n}\nlocal current_display_style = 1\n\nlocal pm = require'pigmentor'\npm.setup{\n    display = display_styles[current_display_style],\n}\n\nlocal wk = require'which-key'\nwk.add({\n    { '\u003cleader\u003ep', group = 'Pigmentor…' },\n    { '\u003cleader\u003ept', pm.toggle, desc = 'Toggle globally' },\n    { '\u003cleader\u003epc', function()\n        if current_display_style \u003e= #display_styles then\n            current_display_style = 1\n        else\n            current_display_style = current_display_style + 1\n        end\n        pm.load_config{display = display_styles[current_display_style]}\n        pm.refresh_visible_buffers()\n    end, desc = 'Cycle display style' },\n})\n```\n\n## 🎯 Mode Configuration\n\nPigmentor can behave differently in various Vim modes:\n\n- **cursor**: Show colors for the item under the cursor\n- **line**: Show colors for the entire current line\n- **visible**: Show colors for all visible lines in the buffer\n\nFor example, you might want to see all colors while in normal mode, but only show colors for visible lines in insert mode to reduce distractions.\n\n## 🔧 Advanced Configuration\n\n### Custom Color Formats\n\nWhile Pigmentor comes with built-in support for common color formats, you can examine `lua/pigmentor/colormatchers.lua` to understand how to extend it with custom patterns.\n\n### Performance Tuning\n\nFor large files or when performance is a concern:\n\n```lua\nrequire'pigmentor'.setup{\n  display = {\n    inactive = false,   -- Don't highlight inactive windows\n    priority = 100,     -- Tune extmark priority to not interfere with other extmarks\n  },\n  modes = {\n    i = {\n      visible = false,  -- Disable in insert mode for performance\n    },\n  },\n}\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n### Development\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\nThanks to the Neovim team for the excellent extmarks API.\n\n### Inspiration and Alternatives\n\n- [color-picker.nvim](https://github.com/ziontee113/color-picker.nvim) -\nA powerful plugin that lets Neovim Users choose \u0026 modify colors.\nThis plugin supports RGB, HSL and HEX colors.\n\n\n- [ccc.nvim](https://github.com/uga-rosa/ccc.nvim) -\n**C**reate **C**olor **C**ode in neovim.\nUse the colorful sliders to easily generate any desired color!\n\n- [mini.hipatterns](https://github.com/nvim-mini/mini.hipatterns) –\nHighlight patterns in text\n\n- [catgoose/nvim-colorizer.lua](https://github.com/catgoose/nvim-colorizer.lua) –\n  A high-performance color highlighter for Neovim which has no external dependencies!\n  Written in performant Luajit.\n\n\n\n## 🚧 Planned Features\n\nThe following features are planned for future releases:\n\n- 📚 **Vim Help Documentation**: Comprehensive help documentation accessible via `:help pigmentor`\n- 🎨 **Extended Color Format Support**:\n  - **HSV/HSB**: `hsv(0, 100%, 100%)`, `hsva(0, 100%, 100%, 0.5)`\n- ⚡ **Per-Channel Color Manipulation**: Increment/decrement individual color channels using `\u003cCtrl-a\u003e` and `\u003cCtrl-x\u003e` respectively\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003csub\u003eBuilt with ❤️ for the Neovim community\u003c/sub\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmanuelhaffner%2Fpigmentor.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimmanuelhaffner%2Fpigmentor.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmanuelhaffner%2Fpigmentor.nvim/lists"}