From d769f3f6159370e86b0331b86889bd37c3723a10 Mon Sep 17 00:00:00 2001 From: Sora Liu Date: Thu, 18 Apr 2024 15:14:11 +0400 Subject: [PATCH 1/3] feat: Add default_color setting to colortils - Added default_color setting to colortils/init.lua - Set default_color to "#000000" when no color is found --- lua/colortils/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/colortils/init.lua b/lua/colortils/init.lua index 507ac85..fb7d6c7 100644 --- a/lua/colortils/init.lua +++ b/lua/colortils/init.lua @@ -6,6 +6,8 @@ colortils.settings = { color_preview = "█ %s", ---String: "hex"|"rgb"|"hsl" default_format = "hex", + ---String: default color if no color is found + default_color = "#000000", border = "rounded", background = "#FFFFFF", mappings = { @@ -47,7 +49,7 @@ local function get_color(color, invalid) return color_table end if invalid then - color = vim.fn.input("Input a valid color > ", "") + return get_color(colortils.settings.default_color, false) else color = vim.fn.input("Input a color > ", "") end From 91cda217b7f466a19f402ee86d6c80337a2908c6 Mon Sep 17 00:00:00 2001 From: Sora Liu Date: Thu, 18 Apr 2024 15:15:06 +0400 Subject: [PATCH 2/3] feat: Add default_color option to colortils setup - Added default_color option to colortils setup in readme.md file. --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index d92138a..868e5d8 100644 --- a/readme.md +++ b/readme.md @@ -48,6 +48,8 @@ require("colortils").setup({ -- The default in which colors should be saved -- This can be hex, hsl or rgb default_format = "hex", + -- String: default color if no color is found + default_color = "#000000", -- Border for the float border = "rounded", -- Some mappings which are used inside the tools From 0f90cc4cb24594c8b16b7eab6caeba22d9df585f Mon Sep 17 00:00:00 2001 From: Sora Liu Date: Thu, 18 Apr 2024 15:51:47 +0400 Subject: [PATCH 3/3] feat: update set_register_choose_format in colortils setup - Changed set_register_cjoose_format to set_register_choose_format in colortils setup for better clarity and consistency. --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 868e5d8..ab5e98c 100644 --- a/readme.md +++ b/readme.md @@ -69,7 +69,7 @@ require("colortils").setup({ -- save the current color in the register specified above with the format specified above set_register_default_format = "", -- save the current color in the register specified above with a format you can choose - set_register_cjoose_format = "g", + set_register_choose_format = "g", -- replace the color under the cursor with the current color in the format specified above replace_default_format = "", -- replace the color under the cursor with the current color in a format you can choose