From d0f8e445abd486511ce8639182ff124cdf138a67 Mon Sep 17 00:00:00 2001 From: Donnerinoern <72634505+Donnerinoern@users.noreply.github.com> Date: Sat, 10 Feb 2024 02:04:51 +0100 Subject: [PATCH] ui/colorizer: use new maintained fork --- docs/release-notes/rl-0.6.md | 2 ++ flake.lock | 10 +++++----- flake.nix | 2 +- modules/ui/colorizer/colorizer.nix | 29 ++++++++++++++++++++++++++++- modules/ui/colorizer/config.nix | 24 ++++++++++++++---------- 5 files changed, 50 insertions(+), 17 deletions(-) diff --git a/docs/release-notes/rl-0.6.md b/docs/release-notes/rl-0.6.md index 29b5fdb..6cfe4a9 100644 --- a/docs/release-notes/rl-0.6.md +++ b/docs/release-notes/rl-0.6.md @@ -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 diff --git a/flake.lock b/flake.lock index 54a2ac7..e07faf1 100644 --- a/flake.lock +++ b/flake.lock @@ -1063,15 +1063,15 @@ "nvim-colorizer-lua": { "flake": false, "locked": { - "lastModified": 1591879145, - "narHash": "sha256-6YrnItxExL2C8pNIdLd+hXCjsB2MbZANwWkah6dreD8=", - "owner": "norcalli", + "lastModified": 1703321305, + "narHash": "sha256-oKvFN2K+ASlPNwj2rhptR/ErYgo6XKBPhXSZotDdCP0=", + "owner": "NvChad", "repo": "nvim-colorizer.lua", - "rev": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6", + "rev": "85855b38011114929f4058efc97af1059ab3e41d", "type": "github" }, "original": { - "owner": "norcalli", + "owner": "NvChad", "repo": "nvim-colorizer.lua", "type": "github" } diff --git a/flake.nix b/flake.nix index 65bbe94..1321573 100644 --- a/flake.nix +++ b/flake.nix @@ -520,7 +520,7 @@ }; nvim-colorizer-lua = { - url = "github:norcalli/nvim-colorizer.lua"; + url = "github:NvChad/nvim-colorizer.lua"; flake = false; }; diff --git a/modules/ui/colorizer/colorizer.nix b/modules/ui/colorizer/colorizer.nix index 80faa40..8497e04 100644 --- a/modules/ui/colorizer/colorizer.nix +++ b/modules/ui/colorizer/colorizer.nix @@ -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; @@ -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"; }; @@ -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"; + }; }; }; } diff --git a/modules/ui/colorizer/config.nix b/modules/ui/colorizer/config.nix index 0ee5ef9..2706499 100644 --- a/modules/ui/colorizer/config.nix +++ b/modules/ui/colorizer/config.nix @@ -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}; } }) '';