diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | doc/colorizer.txt | 3 | ||||
-rw-r--r-- | doc/index.html | 2 | ||||
-rw-r--r-- | doc/modules/colorizer.buffer_utils.html | 2 | ||||
-rw-r--r-- | doc/modules/colorizer.color_utils.html | 2 | ||||
-rw-r--r-- | doc/modules/colorizer.html | 5 | ||||
-rw-r--r-- | doc/modules/colorizer.matcher_utils.html | 2 | ||||
-rw-r--r-- | doc/modules/colorizer.trie.html | 2 | ||||
-rw-r--r-- | doc/modules/utils.html | 2 | ||||
-rw-r--r-- | lua/colorizer.lua | 5 | ||||
-rw-r--r-- | lua/colorizer/buffer_utils.lua | 5 | ||||
-rw-r--r-- | lua/colorizer/color_utils.lua | 2 | ||||
-rw-r--r-- | lua/colorizer/matcher_utils.lua | 2 |
13 files changed, 22 insertions, 15 deletions
@@ -94,7 +94,8 @@ library to do custom highlighting themselves. 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 = "■", }, diff --git a/doc/colorizer.txt b/doc/colorizer.txt index 5ac2abc..1ff8269 100644 --- a/doc/colorizer.txt +++ b/doc/colorizer.txt @@ -203,7 +203,8 @@ user_default_options *colorizer.user_default_options* 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 = "■", } diff --git a/doc/index.html b/doc/index.html index 427033a..a14a7d8 100644 --- a/doc/index.html +++ b/doc/index.html @@ -77,7 +77,7 @@ </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2022-09-06 15:06:04 </i> +<i style="float:right;">Last updated 2022-09-07 11:26:36 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/colorizer.buffer_utils.html b/doc/modules/colorizer.buffer_utils.html index 142164c..a25f6ef 100644 --- a/doc/modules/colorizer.buffer_utils.html +++ b/doc/modules/colorizer.buffer_utils.html @@ -231,7 +231,7 @@ </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2022-09-06 15:06:04 </i> +<i style="float:right;">Last updated 2022-09-07 11:26:36 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/colorizer.color_utils.html b/doc/modules/colorizer.color_utils.html index 8cd68e2..522999c 100644 --- a/doc/modules/colorizer.color_utils.html +++ b/doc/modules/colorizer.color_utils.html @@ -351,7 +351,7 @@ </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2022-09-06 15:06:04 </i> +<i style="float:right;">Last updated 2022-09-07 11:26:36 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/colorizer.html b/doc/modules/colorizer.html index e02633c..090c424 100644 --- a/doc/modules/colorizer.html +++ b/doc/modules/colorizer.html @@ -393,7 +393,8 @@ Setup an autocmd which enables colorizing for the filetypes and options specifie css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn -- Available modes for <code>mode</code>: 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 = "■", } @@ -477,7 +478,7 @@ Setup an autocmd which enables colorizing for the filetypes and options specifie </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2022-09-06 15:06:04 </i> +<i style="float:right;">Last updated 2022-09-07 11:26:36 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/colorizer.matcher_utils.html b/doc/modules/colorizer.matcher_utils.html index e4cccee..7319be5 100644 --- a/doc/modules/colorizer.matcher_utils.html +++ b/doc/modules/colorizer.matcher_utils.html @@ -106,7 +106,7 @@ Do not try make the function again if it is present in the cache </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2022-09-06 15:06:04 </i> +<i style="float:right;">Last updated 2022-09-07 11:26:36 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/colorizer.trie.html b/doc/modules/colorizer.trie.html index e2c7192..7f015f7 100644 --- a/doc/modules/colorizer.trie.html +++ b/doc/modules/colorizer.trie.html @@ -62,7 +62,7 @@ </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2022-09-06 15:06:04 </i> +<i style="float:right;">Last updated 2022-09-07 11:26:36 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/utils.html b/doc/modules/utils.html index ffe7615..6651212 100644 --- a/doc/modules/utils.html +++ b/doc/modules/utils.html @@ -224,7 +224,7 @@ </div> <!-- id="main" --> <div id="about"> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> -<i style="float:right;">Last updated 2022-09-06 15:06:04 </i> +<i style="float:right;">Last updated 2022-09-07 11:26:36 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> 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) |