From ac97885f575ae5164a967db13b58e9e82765c418 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 12 May 2024 01:43:03 +0200 Subject: [PATCH] colorizer: allow null for all options --- modules/plugins/ui/colorizer/colorizer.nix | 59 ++++++++++++++++++---- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/modules/plugins/ui/colorizer/colorizer.nix b/modules/plugins/ui/colorizer/colorizer.nix index 084f91d..bd37673 100644 --- a/modules/plugins/ui/colorizer/colorizer.nix +++ b/modules/plugins/ui/colorizer/colorizer.nix @@ -4,20 +4,59 @@ ... }: let inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) attrsOf enum nullOr submodule; + inherit (lib.types) attrsOf enum nullOr submodule bool; inherit (lib.modules) mkRenamedOptionModule; - inherit (lib.nvim.config) mkBool; settingSubmodule = submodule { options = { - RGB = mkBool true "Colorize #RGB hex codes"; - RRGGBB = mkBool true "Colorize #RRGGBB hex codes"; - names = mkBool true ''Colorize "Name" codes like Blue''; - RRGGBBAA = mkBool false "Colorize #RRGGBBAA hex codes"; - rgb_fn = mkBool false "Colorize CSS rgb() and rgba() functions"; - hsl_fn = mkBool false "Colorize CSS hsl() and hsla() functions"; - css = mkBool false "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; - css_fn = mkBool false "Enable all CSS *functions*: rgb_fn, hsl_fn"; + RGB = mkOption { + description = "Colorize #RGB hex codes"; + default = null; + type = nullOr bool; + }; + + RRGGBB = mkOption { + description = "Colorize #RRGGBB hex codes"; + default = null; + type = nullOr bool; + }; + + names = mkOption { + description = ''Colorize "Name" codes like Blue''; + default = null; + type = nullOr bool; + }; + + RRGGBBAA = mkOption { + description = "Colorize #RRGGBBAA hex codes"; + default = null; + type = nullOr bool; + }; + + rgb_fn = mkOption { + description = "Colorize CSS rgb() and rgba() functions"; + default = null; + type = nullOr bool; + }; + + hsl_fn = mkOption { + description = "Colorize CSS hsl() and hsla() functions"; + default = null; + type = nullOr bool; + }; + + css = mkOption { + description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; + default = null; + type = nullOr bool; + }; + + css_fn = mkOption { + description = "Enable all CSS *functions*: rgb_fn, hsl_fn"; + default = null; + type = nullOr bool; + }; + mode = mkOption { description = "Set the display mode"; type = nullOr (enum ["foreground" "background"]);