aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/colorizer.lua5
-rw-r--r--lua/colorizer/buffer_utils.lua5
-rw-r--r--lua/colorizer/color_utils.lua2
-rw-r--r--lua/colorizer/matcher_utils.lua2
4 files changed, 9 insertions, 5 deletions
diff --git a/lua/colorizer.lua b/lua/colorizer.lua
index f54f689..b1786d8 100644
--- a/lua/colorizer.lua
+++ b/lua/colorizer.lua
@@ -104,7 +104,8 @@ local BUFFER_LOCAL = {}
-- css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- -- Available modes for `mode`: foreground, background, virtualtext
-- mode = "background", -- Set the display mode.
--- -- Available methods are false / "normal" / "lsp" / "both"
+-- -- Available methods are false / true / "normal" / "lsp" / "both"
+-- -- True is same as normal
-- tailwind = false -- Enable tailwind colors
-- virtualtext = "■",
-- }
@@ -133,7 +134,7 @@ local USER_DEFAULT_OPTIONS = {
css = false,
css_fn = false,
mode = "background",
- tailwind = "lsp",
+ tailwind = false,
virtualtext = "■",
}
diff --git a/lua/colorizer/buffer_utils.lua b/lua/colorizer/buffer_utils.lua
index 498804b..6feaadb 100644
--- a/lua/colorizer/buffer_utils.lua
+++ b/lua/colorizer/buffer_utils.lua
@@ -188,7 +188,10 @@ function highlight_buffer(buf, ns, lines, line_start, options, options_local)
local ok, client = pcall(vim.lsp.get_client_by_id, args.data.client_id)
if ok then
if client.name == "tailwindcss" and client.supports_method "textDocument/documentColor" then
- highlight_buffer_tailwind(buf, DEFAULT_NAMESPACE_TAILWIND, mode, options)
+ -- wait 100 ms for the first request
+ vim.defer_fn(function()
+ highlight_buffer_tailwind(buf, DEFAULT_NAMESPACE_TAILWIND, mode, options)
+ end, 100)
TW_LSP_ATTACHED[buf] = true
end
end
diff --git a/lua/colorizer/color_utils.lua b/lua/colorizer/color_utils.lua
index b90c108..34a04f5 100644
--- a/lua/colorizer/color_utils.lua
+++ b/lua/colorizer/color_utils.lua
@@ -86,7 +86,7 @@ local function color_name_parser(line, i, opts)
end
end
if opts and opts.tailwind then
- if opts.tailwind == "normal" or opts.tailwind == "both" then
+ if opts.tailwind == true or opts.tailwind == "normal" or opts.tailwind == "both" then
local tailwind = require "colorizer.tailwind_colors"
-- setup tailwind colors
for k, v in pairs(tailwind.colors) do
diff --git a/lua/colorizer/matcher_utils.lua b/lua/colorizer/matcher_utils.lua
index 11e56f6..29cd5e9 100644
--- a/lua/colorizer/matcher_utils.lua
+++ b/lua/colorizer/matcher_utils.lua
@@ -71,7 +71,7 @@ local function make_matcher(options)
+ (enable_AARRGGBB and 1 or 4)
+ (enable_rgb and 1 or 5)
+ (enable_hsl and 1 or 6)
- + (enable_tailwind == "normal" and 1 or 7)
+ + ((enable_tailwind == true or enable_tailwind == "normal") and 1 or 7)
+ (enable_tailwind == "lsp" and 1 or 8)
+ (enable_tailwind == "both" and 1 or 9)