Skip to content

Commit

Permalink
ui/colorizer: use new maintained fork
Browse files Browse the repository at this point in the history
  • Loading branch information
Donnerinoern committed Feb 10, 2024
1 parent 9ceab45 commit d0f8e44
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 17 deletions.
2 changes: 2 additions & 0 deletions docs/release-notes/rl-0.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

- colorizer.nvim: switched to a maintained fork

[notashelf](https://github.com/notashelf):

- Finished moving to `nixosOptionsDoc` in the documentation and changelog. We are fully free of asciidoc now
Expand Down
10 changes: 5 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@
};

nvim-colorizer-lua = {
url = "github:norcalli/nvim-colorizer.lua";
url = "github:NvChad/nvim-colorizer.lua";
flake = false;
};

Expand Down
29 changes: 28 additions & 1 deletion modules/ui/colorizer/colorizer.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ in {
options.vim.ui.colorizer = {
enable = mkEnableOption "nvim-colorizer.lua for color highlighting";

filetypes = mkOption {
type = with types; attrsOf attrs;
default = {
css = {};
scss = {};
};
description = "Filetypes to highlight on";
};

options = {
rgb = mkOption {
type = types.bool;
Expand Down Expand Up @@ -47,7 +56,7 @@ in {

css = mkOption {
type = types.bool;
default = true;
default = false;
description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB";
};

Expand All @@ -62,6 +71,24 @@ in {
default = "background";
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";
};
};
};
}
24 changes: 14 additions & 10 deletions modules/ui/colorizer/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ in {

vim.luaConfigRC.colorizer = nvim.dag.entryAnywhere ''
require('colorizer').setup({
DEFAULT_OPTIONS = {
RGB = ${boolToString cfg.options.rgb};
RRGGBB = ${boolToString cfg.options.rrggbb};
names = ${boolToString cfg.options.names};
RRGGBBAA = ${boolToString cfg.options.rrggbbaa};
rgb_fn = ${boolToString cfg.options.rgb_fn};
hsl_fn = ${boolToString cfg.options.hsl_fn};
css = ${boolToString cfg.options.css};
css_fn = ${boolToString cfg.options.css_fn};
mode = '${toString cfg.options.mode}';
filetypes = ${nvim.lua.attrsetToLuaTable cfg.filetypes},
user_default_options = {
RGB = ${boolToString cfg.options.rgb};
RRGGBB = ${boolToString cfg.options.rrggbb};
names = ${boolToString cfg.options.names};
RRGGBBAA = ${boolToString cfg.options.rrggbbaa};
rgb_fn = ${boolToString cfg.options.rgb_fn};
hsl_fn = ${boolToString cfg.options.hsl_fn};
css = ${boolToString cfg.options.css};
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};
}
})
'';
Expand Down

0 comments on commit d0f8e44

Please sign in to comment.