ui/nvim-highlight-colors: init

This commit is contained in:
jules 2025-08-30 12:12:14 -04:00
commit 9c21bd06a2
6 changed files with 144 additions and 0 deletions

View file

@ -492,3 +492,10 @@
- Fix default [blink.cmp] sources "path" and "buffer" not working when - Fix default [blink.cmp] sources "path" and "buffer" not working when
`autocomplete.nvim-cmp.enable` was disabled and `autocomplete.nvim-cmp.enable` was disabled and
`autocomplete.nvim-cmp.sources` had not been modified. `autocomplete.nvim-cmp.sources` had not been modified.
[Jules](https://github.com/jules-sommer):
[nvim-highlight-colors]: https://github.com/brenoprata10/nvim-highlight-colors
- Add [nvim-highlight-colors] plugin in `vim.ui.nvim-highlight-colors` with
`enable` and `setupOpts`

View file

@ -3,6 +3,7 @@
./borders ./borders
./breadcrumbs ./breadcrumbs
./colorful-menu-nvim ./colorful-menu-nvim
./nvim-highlight-colors
./colorizer ./colorizer
./fastaction ./fastaction
./illuminate ./illuminate

View file

@ -0,0 +1,25 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.ui.nvim-highlight-colors;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
"nvim-highlight-colors"
];
options.termguicolors = true;
pluginRC.nvim-highlight-colors = entryAnywhere ''
require('nvim-highlight-colors').setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./nvim-highlight-colors.nix
./config.nix
];
}

View file

@ -0,0 +1,92 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) attrsOf enum nullOr submodule bool str;
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.nvim.config) mkBool;
in {
options.vim.ui.nvim-highlight-colors = {
enable = mkEnableOption "color highlighting [nvim-highlight-colors.lua]";
setupOpts = mkPluginSetupOption "nvim-highlight-colors" {
render = mkOption {
type = enum ["background" "foreground" "virtual"];
default = "background";
example = "virtual";
description = ''
Style to render color highlighting with.
::: {.note}
Each render style works as follows:
- 'background' sets the background
highlight of the matched color string
to the RGB color it describes.
- 'foreground' sets the foreground
highlight of the matched color string
to the RGB color it describes.
- 'virtual' displays the matched color
with virtual text alongside the color
string in the buffer. Virtual text can
be configured to display the color in
various ways, i.e custom virtual symbol
(via `virtual_symbol`) positioning
relative to string, suffix/prefix, etc.
:::
'';
};
virtual_symbol = mkOption {
type = nullOr str;
default = "";
example = "";
description = ''
Symbol to display color with as virtual text.
::: {.note}
Only applies when `render` is set to 'virtual'.
:::
'';
};
virtual_symbol_prefix = mkOption {
type = nullOr str;
default = "";
description = ''
String used as a prefix to the virtual_symbol
For example, to add padding between the color
string and the virtual symbol.
::: {.note}
Only applies when `render` is set to 'virtual'.
:::
'';
};
virtual_symbol_suffix = mkOption {
type = nullOr str;
default = " ";
description = ''
String used as a suffix to the virtual_symbol
For example, to add padding between the virtual
symbol and other text in the buffer.
::: {.note}
Only applies when `render` is set to 'virtual'.
:::
'';
};
enable_hex = mkBool true "Enable highlighting for hex color strings, i.e `#FFFFFF`.";
enable_short_hex = mkBool true "Enable highlighting for shorthand hex color format, i.e `#FFF`.";
enable_rgb = mkBool true "Enable highlighting for RGB color strings, i.e `rgb(0, 0, 0)` or `rgb(0 0 0)`.";
enable_hsl = mkBool true "Enable highlighting for HSL color strings, i.e `hsl(150deg 30% 40%)`.";
enable_ansi = mkBool true "Enable highlighting for HSL color strings, i.e `\033[0;34m`.";
enable_hsl_without_function = mkBool true "Enable highlighting for bare HSL color strings, i.e `--foreground: 0 69% 69%;`.";
enable_var_usage = mkBool true "Enable highlighting for CSS variables which reference colors, i.e `var(--testing-color)`.";
enable_named_colors = mkBool true "Enable highlighting for named colors, i.e `green`.";
enable_tailwind = mkBool false "Enable highlighting for tailwind color classes, i.e `bg-blue-500`.";
};
};
}

View file

@ -1838,6 +1838,19 @@
"url": "https://github.com/amrbashir/nvim-docs-view/archive/f674ba57349849bce894efdd54096483c88e810b.tar.gz", "url": "https://github.com/amrbashir/nvim-docs-view/archive/f674ba57349849bce894efdd54096483c88e810b.tar.gz",
"hash": "0ifbfhifly5sdsbxv1p71wvl644jz505ln9j1yr6qwvyk6a2krm1" "hash": "0ifbfhifly5sdsbxv1p71wvl644jz505ln9j1yr6qwvyk6a2krm1"
}, },
"nvim-highlight-colors": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "brenoprata10",
"repo": "nvim-highlight-colors"
},
"branch": "main",
"submodules": false,
"revision": "1ce0a09bfc28c7274e649d20927cea51e440b65c",
"url": "https://github.com/brenoprata10/nvim-highlight-colors/archive/1ce0a09bfc28c7274e649d20927cea51e440b65c.tar.gz",
"hash": "1wsscm2mycd7zalxv8paa3fk0qy46bbhq4yfr73sl71wvkdh6yjn"
},
"nvim-lightbulb": { "nvim-lightbulb": {
"type": "Git", "type": "Git",
"repository": { "repository": {