aboutsummaryrefslogtreecommitdiff
path: root/doc/colorizer.txt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/colorizer.txt')
-rw-r--r--doc/colorizer.txt105
1 files changed, 73 insertions, 32 deletions
diff --git a/doc/colorizer.txt b/doc/colorizer.txt
index 1480756..5ac2abc 100644
--- a/doc/colorizer.txt
+++ b/doc/colorizer.txt
@@ -85,6 +85,9 @@ Functions: ~
|clear_highlight_cache| - Clear the highlight cache and reload all buffers.
+Tables: ~
+ |user_default_options| - defaults options.
+
Fields: ~
|DEFAULT_NAMESPACE| - Default namespace used in
`colorizer.buffer_utils.highlight_buffer` and `attach_to_buffer`.
@@ -105,7 +108,7 @@ is_buffer_attached({buf}) *colorizer.is_buffer_attached*
{buf} - number|nil: A value of 0 implies the current buffer.
returns:~
- number|nil: if attached to the buffer, false otherwise.
+ number or nil: if attached to the buffer, false otherwise.
See also:~
|highlight_buffer|
@@ -149,25 +152,12 @@ setup({config}) *colorizer.setup*
>
require("colorizer").setup {
filetypes = { "*" },
- user_default_options = {
- RGB = true, -- #RGB hex codes
- RRGGBB = true, -- #RRGGBB hex codes
- names = true, -- "Name" codes like Blue or blue
- RRGGBBAA = false, -- #RRGGBBAA hex codes
- AARRGGBB = false, -- 0xAARRGGBB hex codes
- rgb_fn = false, -- CSS rgb() and rgba() functions
- hsl_fn = false, -- CSS hsl() and hsla() functions
- css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB,
- RRGGBB
- css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
- -- Available modes for `mode`: foreground, background, virtualtext
- mode = "background", -- Set the display mode.
- virtualtext = "■",
- },
+ user_default_options,
-- all the sub-options of filetypes apply to buftypes
buftypes = {},
}
<
+ For all user_default_options, see |user_default_options|
Parameters: ~
@@ -196,6 +186,46 @@ clear_highlight_cache() *colorizer.clear_highlight_cache*
+user_default_options *colorizer.user_default_options*
+ defaults options.
+
+>
+ user_default_options = {
+ RGB = true, -- #RGB hex codes
+ RRGGBB = true, -- #RRGGBB hex codes
+ names = true, -- "Name" codes like Blue or blue
+ RRGGBBAA = false, -- #RRGGBBAA hex codes
+ AARRGGBB = false, -- 0xAARRGGBB hex codes
+ rgb_fn = false, -- CSS rgb() and rgba() functions
+ hsl_fn = false, -- CSS hsl() and hsla() functions
+ css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB,
+ RRGGBB
+ 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"
+ tailwind = false -- Enable tailwind colors
+ virtualtext = "■",
+ }
+<
+
+
+ Fields: ~
+ {RGB} - boolean
+ {RRGGBB} - boolean
+ {names} - boolean
+ {RRGGBBAA} - boolean
+ {AARRGGBB} - boolean
+ {rgb_fn} - boolean
+ {hsl_fn} - boolean
+ {css} - boolean
+ {css_fn} - boolean
+ {mode} - string
+ {tailwind} - boolean|string
+ {virtualtext} - string
+
+
+
DEFAULT_NAMESPACE *colorizer.DEFAULT_NAMESPACE*
Default namespace used in `colorizer.buffer_utils.highlight_buffer` and
`attach_to_buffer`.
@@ -231,7 +261,7 @@ Fields: ~
*colorizer.buffer_utils.highlight_buffer*
-highlight_buffer({buf}, {ns}, {lines}, {line_start}, {options})
+highlight_buffer({buf}, {ns}, {lines}, {line_start}, {options}, {options_local})
Highlight the buffer region.
Highlight starting from `line_start` (0-indexed) for each line described by
@@ -246,15 +276,25 @@ highlight_buffer({buf}, {ns}, {lines}, {line_start}, {options})
{lines} - table: the lines to highlight from the buffer.
{line_start} - number: line_start should be 0-indexed
{options} - table: Configuration options as described in `setup`
+ {options_local} - table: Buffer local variables
+
+ returns:~
+ nil or boolean or number,function or nil
+
-rehighlight_buffer({buf}, {options}) *colorizer.buffer_utils.rehighlight_buffer*
+ *colorizer.buffer_utils.rehighlight_buffer*
+rehighlight_buffer({buf}, {options}, {options_local})
Rehighlight the buffer if colorizer is active
Parameters: ~
{buf} - number: Buffer number
{options} - table: Buffer options
+ {options_local} - table|nil: Buffer local variables
+
+ returns:~
+ nil or boolean or number,function or nil
@@ -321,7 +361,7 @@ color_is_bright({r}, {g}, {b}) *colorizer.color_utils.color_is_bright*
-color_name_parser({line}, {i}) *colorizer.color_utils.color_name_parser*
+color_name_parser({line}, {i}, {opts}) *colorizer.color_utils.color_name_parser*
Grab all the colour values from `vim.api.nvim_get_color_map` and create a
lookup table.
@@ -331,6 +371,7 @@ color_name_parser({line}, {i}) *colorizer.color_utils.color_name_parser*
Parameters: ~
{line} - string: Line to parse
{i} - number: Index of line from where to start parsing
+ {opts} - table: Currently contains whether tailwind is enabled or not
@@ -342,8 +383,8 @@ rgb_function_parser({line}, {i}) *colorizer.color_utils.rgb_function_parser*
{i} - number: Index of line from where to start parsing
returns:~
- number|nil: Index of line where the rgb function ended
- string|nil: rgb hex value
+ number or nil: Index of line where the rgb function ended
+ string or nil: rgb hex value
@@ -360,8 +401,8 @@ rgba_function_parser({line}, {i}) *colorizer.color_utils.rgba_function_parser*
{i} - number: Index of line from where to start parsing
returns:~
- number|nil: Index of line where the rgba function ended
- string|nil: rgb hex value
+ number or nil: Index of line where the rgba function ended
+ string or nil: rgb hex value
@@ -373,8 +414,8 @@ hsl_function_parser({line}, {i}) *colorizer.color_utils.hsl_function_parser*
{i} - number: Index of line from where to start parsing
returns:~
- number|nil: Index of line where the hsl function ended
- string|nil: rgb hex value
+ number or nil: Index of line where the hsl function ended
+ string or nil: rgb hex value
@@ -386,8 +427,8 @@ hsla_function_parser({line}, {i}) *colorizer.color_utils.hsla_function_parser*
{i} - number: Index of line from where to start parsing
returns:~
- number|nil: Index of line where the hsla function ended
- string|nil: rgb hex value
+ number or nil: Index of line where the hsla function ended
+ string or nil: rgb hex value
@@ -402,8 +443,8 @@ argb_hex_parser({line}, {i}) *colorizer.color_utils.argb_hex_parser*
{i} - number: index of line from where to start parsing
returns:~
- number|nil: index of line where the hex value ended
- string|nil: rgb hex value
+ number or nil: index of line where the hex value ended
+ string or nil: rgb hex value
@@ -419,8 +460,8 @@ rgba_hex_parser({line}, {i}, {opts}) *colorizer.color_utils.rgba_hex_parser*
{opts} - table: Containing minlen, maxlen, valid_lengths
returns:~
- number|nil: index of line where the hex value ended
- string|nil: rgb hex value
+ number or nil: index of line where the hex value ended
+ string or nil: rgb hex value
@@ -449,7 +490,7 @@ make_matcher({options}) *colorizer.matcher_utils.make_matcher*
{options} - table: options created in `colorizer.setup`
returns:~
- function|boolean: function which will just parse the line for enabled
+ function or boolean: function which will just parse the line for enabled
parsers