Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(init): add default_color option to colortils setup #36

Merged
merged 3 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lua/colortils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -67,7 +69,7 @@ require("colortils").setup({
-- save the current color in the register specified above with the format specified above
set_register_default_format = "<cr>",
-- save the current color in the register specified above with a format you can choose
set_register_cjoose_format = "g<cr>",
set_register_choose_format = "g<cr>",
-- replace the color under the cursor with the current color in the format specified above
replace_default_format = "<m-cr>",
-- replace the color under the cursor with the current color in a format you can choose
Expand Down
Loading