From 4d63250a48741989f0bd338b8dcc99dafccfe4dd Mon Sep 17 00:00:00 2001 From: Jens Feodor Nielsen Date: Tue, 16 Dec 2025 16:31:38 +0100 Subject: [PATCH] utility/ccc: add inputs and outputs options Added `ccc.nvim` options `vim.utility.ccc.inputs` and `vim.utility.ccc.outputs` to make input color systems and output color formats configurable. --- docs/manual/release-notes/rl-0.8.md | 12 +++++- modules/plugins/utility/ccc/ccc.nix | 59 +++++++++++++++++++++++++- modules/plugins/utility/ccc/config.nix | 9 ++-- 3 files changed, 71 insertions(+), 9 deletions(-) diff --git a/docs/manual/release-notes/rl-0.8.md b/docs/manual/release-notes/rl-0.8.md index bb26a9a2..30034f6d 100644 --- a/docs/manual/release-notes/rl-0.8.md +++ b/docs/manual/release-notes/rl-0.8.md @@ -622,12 +622,20 @@ - Added gitFiles mapping option to telescope -[Ring-A-Ding-Ding-Baby](https://github.com/Ring-A-Ding-Ding-Baby) +[Ring-A-Ding-Ding-Baby](https://github.com/Ring-A-Ding-Ding-Baby): - Aligned `codelldb` adapter setup with [rustaceanvim]’s built-in logic. - Added `languages.rust.dap.backend` option to choose between `codelldb` and `lldb-dap` adapters. -[Libadoxon](https://github.com/Libadoxon) +[Libadoxon](https://github.com/Libadoxon): - `toggleterm` open map now also works when in terminal mode + +[jfeo](https://github.com/jfeo): + +[ccc.nvim]: https://github.com/uga-rosa/ccc.nvim + +- Added [ccc.nvim] options {option}`vim.utility.ccc.inputs` and + {option}`vim.utility.ccc.outputs` to make input color systems and output color + formats configurable. diff --git a/modules/plugins/utility/ccc/ccc.nix b/modules/plugins/utility/ccc/ccc.nix index f900b531..e51d86da 100644 --- a/modules/plugins/utility/ccc/ccc.nix +++ b/modules/plugins/utility/ccc/ccc.nix @@ -1,10 +1,67 @@ {lib, ...}: let - inherit (lib.options) mkEnableOption; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) listOf enum; inherit (lib.nvim.binds) mkMappingOption; in { options.vim.utility.ccc = { enable = mkEnableOption "ccc color picker for neovim"; + inputs = mkOption { + type = listOf (enum [ + "rgb" + "hsl" + "hwb" + "lab" + "lch" + "oklab" + "oklch" + "cmyk" + "hsluv" + "okhsl" + "hsv" + "okhsv" + "xyz" + ]); + default = [ + "hsl" + ]; + description = '' + List of color systems to be activated. + + The toggle input mode action toggles in this order. The first one is + the default used at the first startup. Once activated, it will keep the + previous input mode. + ''; + }; + + outputs = mkOption { + type = listOf (enum [ + "hex" + "hex_short" + "css_hsl" + "css_rgb" + "css_rgba" + "css_hwb" + "css_lab" + "css_lch" + "css_oklab" + "css_oklch" + "float" + ]); + default = [ + "css_hsl" + "css_rgb" + "hex" + ]; + description = '' + List of output formats to be activated. + + The toggle output mode action toggles in this order. The first one is + the default used at the first startup. Once activated, it will keep the + previous output mode. + ''; + }; + mappings = { quit = mkMappingOption "Cancel and close the UI without replace or insert" ""; increase10 = mkMappingOption "Increase the value times delta of the slider" ""; diff --git a/modules/plugins/utility/ccc/config.nix b/modules/plugins/utility/ccc/config.nix index 33948562..e978ed14 100644 --- a/modules/plugins/utility/ccc/config.nix +++ b/modules/plugins/utility/ccc/config.nix @@ -3,6 +3,7 @@ lib, ... }: let + inherit (lib.strings) concatStringsSep; inherit (lib.modules) mkIf; inherit (lib.nvim.dag) entryAnywhere; @@ -30,12 +31,8 @@ in { }, alpha_show = "hide", -- needed when highlighter.lsp is set to true recognize = { output = true }, -- automatically recognize color format under cursor - inputs = { ccc.input.hsl }, - outputs = { - ccc.output.css_hsl, - ccc.output.css_rgb, - ccc.output.hex, - }, + inputs = {${concatStringsSep "," (map (input: "ccc.input.${input}") cfg.inputs)}}, + outputs = {${concatStringsSep "," (map (output: "ccc.output.${output}") cfg.outputs)}}, convert = { { ccc.picker.hex, ccc.output.css_hsl }, { ccc.picker.css_rgb, ccc.output.css_hsl },