Merge pull request #203 from Donnerinoern/ui/colorizer

ui/colorizer: rebase on maintained fork
This commit is contained in:
NotAShelf 2024-02-10 15:31:40 +03:00 committed by GitHub
commit a519c6364c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 50 additions and 17 deletions

View file

@ -20,6 +20,8 @@ Release notes for release 0.6
- Fixed markdown preview with Glow not working and added an option for changing the preview keybind - Fixed markdown preview with Glow not working and added an option for changing the preview keybind
- colorizer.nvim: switched to a maintained fork
[notashelf](https://github.com/notashelf): [notashelf](https://github.com/notashelf):
- Finished moving to `nixosOptionsDoc` in the documentation and changelog. We are fully free of asciidoc now - Finished moving to `nixosOptionsDoc` in the documentation and changelog. We are fully free of asciidoc now

View file

@ -1063,15 +1063,15 @@
"nvim-colorizer-lua": { "nvim-colorizer-lua": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1591879145, "lastModified": 1703321305,
"narHash": "sha256-6YrnItxExL2C8pNIdLd+hXCjsB2MbZANwWkah6dreD8=", "narHash": "sha256-oKvFN2K+ASlPNwj2rhptR/ErYgo6XKBPhXSZotDdCP0=",
"owner": "norcalli", "owner": "NvChad",
"repo": "nvim-colorizer.lua", "repo": "nvim-colorizer.lua",
"rev": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6", "rev": "85855b38011114929f4058efc97af1059ab3e41d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "norcalli", "owner": "NvChad",
"repo": "nvim-colorizer.lua", "repo": "nvim-colorizer.lua",
"type": "github" "type": "github"
} }

View file

@ -520,7 +520,7 @@
}; };
nvim-colorizer-lua = { nvim-colorizer-lua = {
url = "github:norcalli/nvim-colorizer.lua"; url = "github:NvChad/nvim-colorizer.lua";
flake = false; flake = false;
}; };

View file

@ -8,6 +8,15 @@ in {
options.vim.ui.colorizer = { options.vim.ui.colorizer = {
enable = mkEnableOption "nvim-colorizer.lua for color highlighting"; enable = mkEnableOption "nvim-colorizer.lua for color highlighting";
filetypes = mkOption {
type = with types; attrsOf attrs;
default = {
css = {};
scss = {};
};
description = "Filetypes to highlight on";
};
options = { options = {
rgb = mkOption { rgb = mkOption {
type = types.bool; type = types.bool;
@ -47,7 +56,7 @@ in {
css = mkOption { css = mkOption {
type = types.bool; type = types.bool;
default = true; default = false;
description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB";
}; };
@ -62,6 +71,24 @@ in {
default = "background"; default = "background";
description = "Set the display mode"; description = "Set the display mode";
}; };
tailwind = mkOption {
type = types.bool;
default = false;
description = "Enable tailwind colors";
};
sass = mkOption {
type = types.bool;
default = false;
description = "Enable sass colors";
};
alwaysUpdate = mkOption {
type = types.bool;
default = false;
description = "Update color values even if buffer is not focused, like when using cmp_menu, cmp_docs";
};
}; };
}; };
} }

View file

@ -15,16 +15,20 @@ in {
vim.luaConfigRC.colorizer = nvim.dag.entryAnywhere '' vim.luaConfigRC.colorizer = nvim.dag.entryAnywhere ''
require('colorizer').setup({ require('colorizer').setup({
DEFAULT_OPTIONS = { filetypes = ${nvim.lua.attrsetToLuaTable cfg.filetypes},
RGB = ${boolToString cfg.options.rgb}; user_default_options = {
RRGGBB = ${boolToString cfg.options.rrggbb}; RGB = ${boolToString cfg.options.rgb};
names = ${boolToString cfg.options.names}; RRGGBB = ${boolToString cfg.options.rrggbb};
RRGGBBAA = ${boolToString cfg.options.rrggbbaa}; names = ${boolToString cfg.options.names};
rgb_fn = ${boolToString cfg.options.rgb_fn}; RRGGBBAA = ${boolToString cfg.options.rrggbbaa};
hsl_fn = ${boolToString cfg.options.hsl_fn}; rgb_fn = ${boolToString cfg.options.rgb_fn};
css = ${boolToString cfg.options.css}; hsl_fn = ${boolToString cfg.options.hsl_fn};
css_fn = ${boolToString cfg.options.css_fn}; css = ${boolToString cfg.options.css};
mode = '${toString cfg.options.mode}'; css_fn = ${boolToString cfg.options.css_fn};
mode = '${toString cfg.options.mode}';
tailwind = ${boolToString cfg.options.tailwind};
sass = ${boolToString cfg.options.tailwind};
always_update = ${boolToString cfg.options.alwaysUpdate};
} }
}) })
''; '';