diff options
Diffstat (limited to 'doc/modules')
-rw-r--r-- | doc/modules/colorizer.buffer_utils.html | 222 | ||||
-rw-r--r-- | doc/modules/colorizer.color_utils.html | 355 | ||||
-rw-r--r-- | doc/modules/colorizer.html | 293 | ||||
-rw-r--r-- | doc/modules/colorizer.matcher_utils.html | 113 | ||||
-rw-r--r-- | doc/modules/colorizer.trie.html (renamed from doc/modules/nvim.html) | 19 | ||||
-rw-r--r-- | doc/modules/colorizer.utils.html | 87 | ||||
-rw-r--r-- | doc/modules/trie.html | 27 | ||||
-rw-r--r-- | doc/modules/utils.html | 231 |
8 files changed, 1235 insertions, 112 deletions
diff --git a/doc/modules/colorizer.buffer_utils.html b/doc/modules/colorizer.buffer_utils.html new file mode 100644 index 0000000..f2f75fe --- /dev/null +++ b/doc/modules/colorizer.buffer_utils.html @@ -0,0 +1,222 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>colorizer Docs</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>colorizer</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +<li><a href="#Tables">Tables</a></li> +<li><a href="#Fields">Fields</a></li> +</ul> + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/colorizer.html">colorizer</a></li> + <li><strong>buffer_utils</strong></li> + <li><a href="../modules/colorizer.color_utils.html">color_utils</a></li> + <li><a href="../modules/colorizer.matcher_utils.html">matcher_utils</a></li> + <li><a href="../modules/colorizer.trie.html">trie</a></li> + <li><a href="../modules/utils.html">utils</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>colorizer.buffer_utils</code></h1> +<p>Helper functions to highlight buffer smartly</p> +<p> + +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#highlight_buffer">highlight_buffer (buf, ns, lines, line_start, options)</a></td> + <td class="summary">Highlight the buffer region.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rehighlight_buffer">rehighlight_buffer (buf, options)</a></td> + <td class="summary">Rehighlight the buffer if colorizer is active</td> + </tr> +</table> +<h2><a href="#Tables">Tables</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#HIGHLIGHT_MODE_NAMES">HIGHLIGHT_MODE_NAMES</a></td> + <td class="summary">Highlight mode which will be use to render the colour</td> + </tr> +</table> +<h2><a href="#Fields">Fields</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#DEFAULT_NAMESPACE">DEFAULT_NAMESPACE</a></td> + <td class="summary">Default namespace used in <a href="../modules/colorizer.buffer_utils.html#highlight_buffer">highlight_buffer</a> and <a href="../modules/colorizer.html#attach_to_buffer">colorizer.attach_to_buffer</a>.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "highlight_buffer"></a> + <strong>highlight_buffer (buf, ns, lines, line_start, options)</strong> + </dt> + <dd> + Highlight the buffer region. + Highlight starting from <code>line_start</code> (0-indexed) for each line described by <code>lines</code> in the + buffer <code>buf</code> and attach it to the namespace <code>ns</code>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">buf</span> + number: buffer id + </li> + <li><span class="parameter">ns</span> + number: The namespace id. Default is DEFAULT_NAMESPACE. Create it with <code>vim.api.create_namespace</code> + </li> + <li><span class="parameter">lines</span> + table: the lines to highlight from the buffer. + </li> + <li><span class="parameter">line_start</span> + number: line_start should be 0-indexed + </li> + <li><span class="parameter">options</span> + table: Configuration options as described in <code>setup</code> + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "rehighlight_buffer"></a> + <strong>rehighlight_buffer (buf, options)</strong> + </dt> + <dd> + Rehighlight the buffer if colorizer is active + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">buf</span> + number: Buffer number + </li> + <li><span class="parameter">options</span> + table: Buffer options + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Tables"></a>Tables</h2> + + <dl class="function"> + <dt> + <a name = "HIGHLIGHT_MODE_NAMES"></a> + <strong>HIGHLIGHT_MODE_NAMES</strong> + </dt> + <dd> + Highlight mode which will be use to render the colour + + + <h3>Fields:</h3> + <ul> + <li><span class="parameter">background</span> + + + + </li> + <li><span class="parameter">foreground</span> + + + + </li> + <li><span class="parameter">virtualtext</span> + + + + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Fields"></a>Fields</h2> + + <dl class="function"> + <dt> + <a name = "DEFAULT_NAMESPACE"></a> + <strong>DEFAULT_NAMESPACE</strong> + </dt> + <dd> + Default namespace used in <a href="../modules/colorizer.buffer_utils.html#highlight_buffer">highlight_buffer</a> and <a href="../modules/colorizer.html#attach_to_buffer">colorizer.attach_to_buffer</a>. + + + + + + <h3>See also:</h3> + <ul> + <li><a href="../modules/colorizer.buffer_utils.html#highlight_buffer">highlight_buffer</a></li> + <li><a href="../modules/colorizer.html#attach_to_buffer">colorizer.attach_to_buffer</a></li> + </ul> + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</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-03 17:24:13 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/colorizer.color_utils.html b/doc/modules/colorizer.color_utils.html new file mode 100644 index 0000000..613185c --- /dev/null +++ b/doc/modules/colorizer.color_utils.html @@ -0,0 +1,355 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>colorizer Docs</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>colorizer</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/colorizer.html">colorizer</a></li> + <li><a href="../modules/colorizer.buffer_utils.html">buffer_utils</a></li> + <li><strong>color_utils</strong></li> + <li><a href="../modules/colorizer.matcher_utils.html">matcher_utils</a></li> + <li><a href="../modules/colorizer.trie.html">trie</a></li> + <li><a href="../modules/utils.html">utils</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>colorizer.color_utils</code></h1> +<p>Helper functions to parse different colour formats</p> +<p> + +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#color_is_bright">color_is_bright (r, g, b)</a></td> + <td class="summary">Determine whether to use black or white text.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#color_name_parser">color_name_parser (line, i)</a></td> + <td class="summary">Grab all the colour values from <code>vim.api.nvim_get_color_map</code> and create a lookup table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rgb_function_parser">rgb_function_parser (line, i)</a></td> + <td class="summary">Parse for rgb() css function and return rgb hex.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rgba_function_parser">rgba_function_parser (line, i)</a></td> + <td class="summary">Parse for rgba() css function and return rgb hex.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#hsl_function_parser">hsl_function_parser (line, i)</a></td> + <td class="summary">Parse for hsl() css function and return rgb hex.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#hsla_function_parser">hsla_function_parser (line, i)</a></td> + <td class="summary">Parse for hsl() css function and return rgb hex.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#argb_hex_parser">argb_hex_parser (line, i)</a></td> + <td class="summary">parse for 0xaarrggbb and return rgb hex.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rgba_hex_parser">rgba_hex_parser (line, i, opts)</a></td> + <td class="summary">parse for #rrggbbaa and return rgb hex.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "color_is_bright"></a> + <strong>color_is_bright (r, g, b)</strong> + </dt> + <dd> + Determine whether to use black or white text. </p> + +<p> ref: https://stackoverflow.com/a/1855903/837964 + https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">r</span> + number: Red + </li> + <li><span class="parameter">g</span> + number: Green + </li> + <li><span class="parameter">b</span> + number: Blue + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "color_name_parser"></a> + <strong>color_name_parser (line, i)</strong> + </dt> + <dd> + Grab all the colour values from <code>vim.api.nvim_get_color_map</code> and create a lookup table. + COLOR_MAP is used to store the colour values + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">line</span> + string: Line to parse + </li> + <li><span class="parameter">i</span> + number: Index of line from where to start parsing + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "rgb_function_parser"></a> + <strong>rgb_function_parser (line, i)</strong> + </dt> + <dd> + Parse for rgb() css function and return rgb hex. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">line</span> + string: Line to parse + </li> + <li><span class="parameter">i</span> + number: Index of line from where to start parsing + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + number|nil: Index of line where the rgb function ended</li> + <li> + string|nil: rgb hex value</li> + </ol> + + + + +</dd> + <dt> + <a name = "rgba_function_parser"></a> + <strong>rgba_function_parser (line, i)</strong> + </dt> + <dd> + Parse for rgba() css function and return rgb hex. + Todo consider removing the regexes here + Todo this might not be the best approach to alpha channel. + Things like pumblend might be useful here. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">line</span> + string: Line to parse + </li> + <li><span class="parameter">i</span> + number: Index of line from where to start parsing + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + number|nil: Index of line where the rgba function ended</li> + <li> + string|nil: rgb hex value</li> + </ol> + + + + +</dd> + <dt> + <a name = "hsl_function_parser"></a> + <strong>hsl_function_parser (line, i)</strong> + </dt> + <dd> + Parse for hsl() css function and return rgb hex. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">line</span> + string: Line to parse + </li> + <li><span class="parameter">i</span> + number: Index of line from where to start parsing + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + number|nil: Index of line where the hsl function ended</li> + <li> + string|nil: rgb hex value</li> + </ol> + + + + +</dd> + <dt> + <a name = "hsla_function_parser"></a> + <strong>hsla_function_parser (line, i)</strong> + </dt> + <dd> + Parse for hsl() css function and return rgb hex. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">line</span> + string: Line to parse + </li> + <li><span class="parameter">i</span> + number: Index of line from where to start parsing + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + number|nil: Index of line where the hsla function ended</li> + <li> + string|nil: rgb hex value</li> + </ol> + + + + +</dd> + <dt> + <a name = "argb_hex_parser"></a> + <strong>argb_hex_parser (line, i)</strong> + </dt> + <dd> + parse for 0xaarrggbb and return rgb hex. + a format used in android apps + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">line</span> + string: line to parse + </li> + <li><span class="parameter">i</span> + number: index of line from where to start parsing + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + number|nil: index of line where the hex value ended</li> + <li> + string|nil: rgb hex value</li> + </ol> + + + + +</dd> + <dt> + <a name = "rgba_hex_parser"></a> + <strong>rgba_hex_parser (line, i, opts)</strong> + </dt> + <dd> + parse for #rrggbbaa and return rgb hex. + a format used in android apps + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">line</span> + string: line to parse + </li> + <li><span class="parameter">i</span> + number: index of line from where to start parsing + </li> + <li><span class="parameter">opts</span> + table: Containing minlen, maxlen, valid_lengths + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + number|nil: index of line where the hex value ended</li> + <li> + string|nil: rgb hex value</li> + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</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-03 17:24:13 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/colorizer.html b/doc/modules/colorizer.html index e02d18a..3db15a7 100644 --- a/doc/modules/colorizer.html +++ b/doc/modules/colorizer.html @@ -3,7 +3,7 @@ <html> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <head> - <title>Reference</title> + <title>colorizer Docs</title> <link rel="stylesheet" href="../ldoc.css" type="text/css" /> </head> <body> @@ -24,7 +24,7 @@ <div id="navigation"> <br/> -<h1>ldoc</h1> +<h1>colorizer</h1> <ul> <li><a href="../index.html">Index</a></li> @@ -40,8 +40,11 @@ <h2>Modules</h2> <ul class="nowrap"> <li><strong>colorizer</strong></li> - <li><a href="../modules/nvim.html">nvim</a></li> - <li><a href="../modules/trie.html">trie</a></li> + <li><a href="../modules/colorizer.buffer_utils.html">buffer_utils</a></li> + <li><a href="../modules/colorizer.color_utils.html">color_utils</a></li> + <li><a href="../modules/colorizer.matcher_utils.html">matcher_utils</a></li> + <li><a href="../modules/colorizer.trie.html">trie</a></li> + <li><a href="../modules/utils.html">utils</a></li> </ul> </div> @@ -49,42 +52,114 @@ <div id="content"> <h1>Module <code>colorizer</code></h1> +<p>Requires Neovim >= 0.6.0 and <code>set termguicolors</code></p> <p>Highlights terminal CSI ANSI color codes.</p> -<p></p> + <h3>See also:</h3> + <ul> + <li><a href="../modules/colorizer.html#setup">colorizer.setup</a></li> + <li><a href="../modules/colorizer.html#attach_to_buffer">colorizer.attach_to_buffer</a></li> + <li><a href="../modules/colorizer.html#detach_from_buffer">colorizer.detach_from_buffer</a></li> + </ul> + <h3>Usage:</h3> + <ul> + <pre class="example"> Establish the autocmd to highlight all filetypes. + + `lua require 'colorizer'.setup()` + + Highlight using all css highlight modes in every filetype + + `lua require 'colorizer'.setup(user_default_options = { css = true; })` + +============================================================================== +USE WITH COMMANDS *colorizer-commands* + + *:ColorizerAttachToBuffer* + + Attach to the current buffer and start highlighting with the settings as + specified in setup (or the defaults). + + If the buffer was already attached(i.e. being highlighted), the + settings will be reloaded with the ones from setup. + This is useful for reloading settings for just one buffer. + + *:ColorizerDetachFromBuffer* + + Stop highlighting the current buffer (detach). + + *:ColorizerReloadAllBuffers* + + Reload all buffers that are being highlighted currently. + Shortcut for ColorizerAttachToBuffer on every buffer. + + *:ColorizerToggle* + Toggle highlighting of the current buffer. + +USE WITH LUA + + All options that can be passed to user_default_options in `setup` + can be passed here. Can be empty too. + `0` is the buffer number here + + Attach to current buffer <pre> + require("colorizer").attach_to_buffer(0, { + mode = "background", + css = false, + }) +</pre> + Detach from buffer <pre> + require("colorizer").detach_from_buffer(0, { + mode = "background", + css = false, + }) +</pre> +</pre> + </ul> + <h3>Info:</h3> + <ul> + <li><strong>Author</strong>: Ashkan Kiani <a href="mailto:from-nvim-colorizer.lua@kiani.io">from-nvim-colorizer.lua@kiani.io</a></li> + </ul> <h2><a href="#Functions">Functions</a></h2> <table class="function_list"> <tr> - <td class="name" nowrap><a href="#highlight_buffer">highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start, options)</a></td> - <td class="summary">Highlight the buffer region.</td> + <td class="name" nowrap><a href="#highlight_buffer">highlight_buffer ()</a></td> + <td class="summary">Highlight the buffer region</td> </tr> <tr> - <td class="name" nowrap><a href="#attach_to_buffer">attach_to_buffer ([buf=0|nil[, options]])</a></td> - <td class="summary">Attach to a buffer and continuously highlight changes.</td> + <td class="name" nowrap><a href="#is_buffer_attached">is_buffer_attached (buf)</a></td> + <td class="summary">Check if attached to a buffer.</td> </tr> <tr> - <td class="name" nowrap><a href="#detach_from_buffer">detach_from_buffer ([buf=0|nil[, ns=DEFAULT_NAMESPACE]])</a></td> + <td class="name" nowrap><a href="#detach_from_buffer">detach_from_buffer (buf, ns)</a></td> <td class="summary">Stop highlighting the current buffer.</td> </tr> <tr> - <td class="name" nowrap><a href="#setup">setup ([filetypes={'*'}[, default_options]])</a></td> + <td class="name" nowrap><a href="#attach_to_buffer">attach_to_buffer (buf, options, typ)</a></td> + <td class="summary">Attach to a buffer and continuously highlight changes.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#setup">setup (config)</a></td> <td class="summary">Easy to use function if you want the full setup without fine grained control.</td> </tr> <tr> + <td class="name" nowrap><a href="#get_buffer_options">get_buffer_options (buf)</a></td> + <td class="summary">Return the currently active buffer options.</td> + </tr> + <tr> <td class="name" nowrap><a href="#reload_all_buffers">reload_all_buffers ()</a></td> <td class="summary">Reload all of the currently active highlighted buffers.</td> </tr> <tr> - <td class="name" nowrap><a href="#get_buffer_options">get_buffer_options ([buf=0|nil])</a></td> - <td class="summary">Return the currently active buffer options.</td> + <td class="name" nowrap><a href="#clear_highlight_cache">clear_highlight_cache ()</a></td> + <td class="summary">Clear the highlight cache and reload all buffers.</td> </tr> </table> <h2><a href="#Fields">Fields</a></h2> <table class="function_list"> <tr> <td class="name" nowrap><a href="#DEFAULT_NAMESPACE">DEFAULT_NAMESPACE</a></td> - <td class="summary">Default namespace used in `highlight_buffer` and `attach_to_buffer`.</td> + <td class="summary">Default namespace used in <a href="../modules/colorizer.buffer_utils.html#highlight_buffer">colorizer.buffer_utils.highlight_buffer</a> and <a href="../modules/colorizer.html#attach_to_buffer">attach_to_buffer</a>.</td> </tr> </table> @@ -97,97 +172,92 @@ <dl class="function"> <dt> <a name = "highlight_buffer"></a> - <strong>highlight_buffer (buf[, ns=DEFAULT_NAMESPACE], lines, line_start, options)</strong> + <strong>highlight_buffer ()</strong> </dt> <dd> - Highlight the buffer region. -Highlight starting from `line_start` (0-indexed) for each line described by `lines` in the -buffer `buf` and attach it to the namespace `ns`. + Highlight the buffer region + + + <h3>See also:</h3> + <ul> + <a href="../modules/colorizer.buffer_utils.html#highlight_buffer">colorizer.buffer_utils.highlight_buffer</a> + </ul> + + +</dd> + <dt> + <a name = "is_buffer_attached"></a> + <strong>is_buffer_attached (buf)</strong> + </dt> + <dd> + Check if attached to a buffer. + + <h3>Parameters:</h3> <ul> <li><span class="parameter">buf</span> - <span class="types"><span class="type">integer</span></span> - buffer id. - </li> - <li><span class="parameter">ns</span> - <span class="types"><span class="type">integer</span></span> - the namespace id. Create it with `vim.api.create_namespace` - (<em>default</em> DEFAULT_NAMESPACE) - </li> - <li><span class="parameter">lines</span> - <span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">{string,...}</a></span> - the lines to highlight from the buffer. - </li> - <li><span class="parameter">line_start</span> - <span class="types"><span class="type">integer</span></span> - should be 0-indexed - </li> - <li><span class="parameter">options</span> - Configuration options as described in `setup` + number|nil: A value of 0 implies the current buffer. </li> </ul> + <h3>Returns:</h3> + <ol> + + number|nil: if attached to the buffer, false otherwise. + </ol> <h3>See also:</h3> <ul> - <a href="../modules/colorizer.html#setup">setup</a> + <a href="../modules/colorizer.html#highlight_buffer">highlight_buffer</a> </ul> </dd> <dt> - <a name = "attach_to_buffer"></a> - <strong>attach_to_buffer ([buf=0|nil[, options]])</strong> + <a name = "detach_from_buffer"></a> + <strong>detach_from_buffer (buf, ns)</strong> </dt> <dd> - Attach to a buffer and continuously highlight changes. + Stop highlighting the current buffer. <h3>Parameters:</h3> <ul> <li><span class="parameter">buf</span> - <span class="types"><span class="type">integer</span></span> - A value of 0 implies the current buffer. - (<em>default</em> 0|nil) + number|nil: buf A value of 0 or nil implies the current buffer. </li> - <li><span class="parameter">options</span> - Configuration options as described in `setup` - (<em>optional</em>) + <li><span class="parameter">ns</span> + number|nil: ns the namespace id, if not given DEFAULT_NAMESPACE is used </li> </ul> - <h3>See also:</h3> - <ul> - <a href="../modules/colorizer.html#setup">setup</a> - </ul> </dd> <dt> - <a name = "detach_from_buffer"></a> - <strong>detach_from_buffer ([buf=0|nil[, ns=DEFAULT_NAMESPACE]])</strong> + <a name = "attach_to_buffer"></a> + <strong>attach_to_buffer (buf, options, typ)</strong> </dt> <dd> - Stop highlighting the current buffer. + Attach to a buffer and continuously highlight changes. <h3>Parameters:</h3> <ul> <li><span class="parameter">buf</span> - <span class="types"><span class="type">integer</span></span> - A value of 0 or nil implies the current buffer. - (<em>default</em> 0|nil) + integer: A value of 0 implies the current buffer. </li> - <li><span class="parameter">ns</span> - <span class="types"><span class="type">integer</span></span> - the namespace id. - (<em>default</em> DEFAULT_NAMESPACE) + <li><span class="parameter">options</span> + table: Configuration options as described in <a href="../modules/colorizer.html#setup">setup</a> + </li> + <li><span class="parameter">typ</span> + string|nil: "buf" or "file" - The type of buffer option </li> </ul> @@ -198,34 +268,52 @@ buffer `buf` and attach it to the namespace `ns`. </dd> <dt> <a name = "setup"></a> - <strong>setup ([filetypes={'*'}[, default_options]])</strong> + <strong>setup (config)</strong> </dt> <dd> - Easy to use function if you want the full setup without fine grained control. - Setup an autocmd which enables colorizing for the filetypes and options specified. -<p> By default highlights all FileTypes. -<p> Example config: - ``` - { 'scss', 'html', css = { rgb_fn = true; }, javascript = { no_names = true } } - ``` -<p> You can combine an array and more specific options. - Possible options: - - `no_names`: Don't highlight names like Blue - - `rgb_fn`: Highlight `rgb(...)` functions. - - `mode`: Highlight mode. Valid options: `foreground`,`background` + +<p>Easy to use function if you want the full setup without fine grained control. +Setup an autocmd which enables colorizing for the filetypes and options specified.</p> + +<p>By default highlights all FileTypes.</p> + +<p>Example config:~</p> + +<pre> + { filetypes = { "css", "html" }, user_default_options = { names = true } } +</pre> + +<p>Setup with all the default options:~</p> + +<pre> + 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 <code>mode</code>: foreground, background, virtualtext + mode = "background", -- Set the display mode. + virtualtext = "■", + }, + -- all the sub-options of filetypes apply to buftypes + buftypes = {}, + } +</pre> + <h3>Parameters:</h3> <ul> - <li><span class="parameter">filetypes</span> - A table/array of filetypes to selectively enable and/or customize. By default, enables all filetypes. - (<em>default</em> {'*'}) - </li> - <li><span class="parameter">default_options</span> - <span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">{[string]=string}</a></span> - Default options to apply for the filetypes enable. - (<em>optional</em>) + <li><span class="parameter">config</span> + table: Config containing above parameters. </li> </ul> @@ -234,11 +322,31 @@ buffer `buf` and attach it to the namespace `ns`. <h3>Usage:</h3> <ul> - <pre class="example"><span class="global">require</span><span class="string">'colorizer'</span>.setup()</pre> + <pre class="example"><span class="backtick"><code>require'colorizer'.setup()</code></span></pre> </ul> </dd> <dt> + <a name = "get_buffer_options"></a> + <strong>get_buffer_options (buf)</strong> + </dt> + <dd> + Return the currently active buffer options. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">buf</span> + number|nil: Buffer number + </li> + </ul> + + + + + +</dd> + <dt> <a name = "reload_all_buffers"></a> <strong>reload_all_buffers ()</strong> </dt> @@ -253,21 +361,13 @@ buffer `buf` and attach it to the namespace `ns`. </dd> <dt> - <a name = "get_buffer_options"></a> - <strong>get_buffer_options ([buf=0|nil])</strong> + <a name = "clear_highlight_cache"></a> + <strong>clear_highlight_cache ()</strong> </dt> <dd> - Return the currently active buffer options. + Clear the highlight cache and reload all buffers. - <h3>Parameters:</h3> - <ul> - <li><span class="parameter">buf</span> - <span class="types"><span class="type">integer</span></span> - A value of 0 or nil implies the current buffer. - (<em>default</em> 0|nil) - </li> - </ul> @@ -283,8 +383,7 @@ buffer `buf` and attach it to the namespace `ns`. <strong>DEFAULT_NAMESPACE</strong> </dt> <dd> - Default namespace used in `highlight_buffer` and `attach_to_buffer`. - The name is "terminal_highlight" + Default namespace used in <a href="../modules/colorizer.buffer_utils.html#highlight_buffer">colorizer.buffer_utils.highlight_buffer</a> and <a href="../modules/colorizer.html#attach_to_buffer">attach_to_buffer</a>. @@ -292,7 +391,7 @@ buffer `buf` and attach it to the namespace `ns`. <h3>See also:</h3> <ul> - <li><a href="../modules/colorizer.html#highlight_buffer">highlight_buffer</a></li> + <li><a href="../modules/colorizer.buffer_utils.html#highlight_buffer">colorizer.buffer_utils.highlight_buffer</a></li> <li><a href="../modules/colorizer.html#attach_to_buffer">attach_to_buffer</a></li> </ul> @@ -305,7 +404,7 @@ buffer `buf` and attach it to the namespace `ns`. </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 2019-10-18 09:40:19 </i> +<i style="float:right;">Last updated 2022-09-03 17:24:13 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/colorizer.matcher_utils.html b/doc/modules/colorizer.matcher_utils.html new file mode 100644 index 0000000..e709932 --- /dev/null +++ b/doc/modules/colorizer.matcher_utils.html @@ -0,0 +1,113 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>colorizer Docs</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>colorizer</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/colorizer.html">colorizer</a></li> + <li><a href="../modules/colorizer.buffer_utils.html">buffer_utils</a></li> + <li><a href="../modules/colorizer.color_utils.html">color_utils</a></li> + <li><strong>matcher_utils</strong></li> + <li><a href="../modules/colorizer.trie.html">trie</a></li> + <li><a href="../modules/utils.html">utils</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>colorizer.matcher_utils</code></h1> +<p>Helper functions for colorizer to enable required parsers</p> +<p> + +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#make_matcher">make_matcher (options)</a></td> + <td class="summary">Parse the given options and return a function with enabled parsers.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "make_matcher"></a> + <strong>make_matcher (options)</strong> + </dt> + <dd> + Parse the given options and return a function with enabled parsers. +if no parsers enabled then return false +Do not try make the function again if it is present in the cache + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">options</span> + table: options created in <a href="../modules/colorizer.html#setup">colorizer.setup</a> + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + function|boolean: function which will just parse the line for enabled parsers + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</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-03 17:24:13 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/modules/nvim.html b/doc/modules/colorizer.trie.html index 8009822..0261786 100644 --- a/doc/modules/nvim.html +++ b/doc/modules/colorizer.trie.html @@ -3,7 +3,7 @@ <html> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <head> - <title>Reference</title> + <title>colorizer Docs</title> <link rel="stylesheet" href="../ldoc.css" type="text/css" /> </head> <body> @@ -24,7 +24,7 @@ <div id="navigation"> <br/> -<h1>ldoc</h1> +<h1>colorizer</h1> <ul> <li><a href="../index.html">Index</a></li> @@ -35,17 +35,20 @@ <h2>Modules</h2> <ul class="nowrap"> <li><a href="../modules/colorizer.html">colorizer</a></li> - <li><strong>nvim</strong></li> - <li><a href="../modules/trie.html">trie</a></li> + <li><a href="../modules/colorizer.buffer_utils.html">buffer_utils</a></li> + <li><a href="../modules/colorizer.color_utils.html">color_utils</a></li> + <li><a href="../modules/colorizer.matcher_utils.html">matcher_utils</a></li> + <li><strong>trie</strong></li> + <li><a href="../modules/utils.html">utils</a></li> </ul> </div> <div id="content"> -<h1>Module <code>nvim</code></h1> -<p>Module of magic functions for nvim</p> -<p></p> +<h1>Module <code>colorizer.trie</code></h1> +<p>Trie implementation in luajit.</p> +<p>todo: write documentation</p> @@ -59,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 2019-10-18 09:40:19 </i> +<i style="float:right;">Last updated 2022-09-03 17:24:13 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/colorizer.utils.html b/doc/modules/colorizer.utils.html new file mode 100644 index 0000000..9bca259 --- /dev/null +++ b/doc/modules/colorizer.utils.html @@ -0,0 +1,87 @@ +============================================================================== +UTILS *colorizer.utils* + +Helper utils + + +============================================================================== +LUA API *colorizer.utils* + +Available Functions: + + |colorizer.utils.byte_is_alphanumeric| - Obvious + + |colorizer.utils.byte_is_hex| - Obvious + + |colorizer.utils.merge| - Merge two tables + TODO Remove this and use vim.tbl_deep_extend + + |colorizer.utils.parse_hex| - Obvious + + |colorizer.utils.percent_or_hex| - Obvious + + + +byte_is_alphanumeric({byte}) |colorizer.utils.byte_is_alphanumeric| + Obvious + + + Parameters: + {byte} - number + + Returns: + boolean + + + +byte_is_hex({byte}) |colorizer.utils.byte_is_hex| + Obvious + + + Parameters: + {byte} - number + + Returns: + boolean + + + +merge({...}) |colorizer.utils.merge| + Merge two tables + TODO Remove this and use vim.tbl_deep_extend + + + Parameters: + {...} - + + Returns: + table + + + +parse_hex({byte}) |colorizer.utils.parse_hex| + Obvious + + + Parameters: + {byte} - number + + Returns: + number + + + +percent_or_hex({v}) |colorizer.utils.percent_or_hex| + Obvious + + + Parameters: + {v} - string + + Returns: + number|nil + + + + + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/doc/modules/trie.html b/doc/modules/trie.html index 5496cfd..e353630 100644 --- a/doc/modules/trie.html +++ b/doc/modules/trie.html @@ -3,7 +3,7 @@ <html> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <head> - <title>Reference</title> + <title>colorizer Docs</title> <link rel="stylesheet" href="../ldoc.css" type="text/css" /> </head> <body> @@ -24,7 +24,7 @@ <div id="navigation"> <br/> -<h1>ldoc</h1> +<h1>colorizer</h1> <ul> <li><a href="../index.html">Index</a></li> @@ -35,8 +35,11 @@ <h2>Modules</h2> <ul class="nowrap"> <li><a href="../modules/colorizer.html">colorizer</a></li> - <li><a href="../modules/nvim.html">nvim</a></li> + <li><a href="../modules/colorizer.buffer_utils.html">buffer_utils</a></li> + <li><a href="../modules/colorizer.color_utils.html">color_utils</a></li> + <li><a href="../modules/colorizer.matcher_utils.html">matcher_utils</a></li> <li><strong>trie</strong></li> + <li><a href="../modules/utils.html">utils</a></li> </ul> </div> @@ -44,9 +47,19 @@ <div id="content"> <h1>Module <code>trie</code></h1> -<p>Trie implementation in luajit - Copyright © 2019 Ashkan Kiani</p> -<p></p> +<p>Trie implementation in luajit.</p> +<p> Copyright © 2019 Ashkan Kiani + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version.</p> + +<p> This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p> @@ -60,7 +73,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 2019-10-18 09:40:19 </i> +<i style="float:right;">Last updated 2022-09-02 21:37:16 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/modules/utils.html b/doc/modules/utils.html new file mode 100644 index 0000000..3e3ff4d --- /dev/null +++ b/doc/modules/utils.html @@ -0,0 +1,231 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>colorizer Docs</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>colorizer</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/colorizer.html">colorizer</a></li> + <li><a href="../modules/colorizer.buffer_utils.html">buffer_utils</a></li> + <li><a href="../modules/colorizer.color_utils.html">color_utils</a></li> + <li><a href="../modules/colorizer.matcher_utils.html">matcher_utils</a></li> + <li><a href="../modules/colorizer.trie.html">trie</a></li> + <li><strong>utils</strong></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>utils</code></h1> +<p>Helper utils</p> +<p> + +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#byte_is_alphanumeric">byte_is_alphanumeric (byte)</a></td> + <td class="summary">Obvious.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#byte_is_hex">byte_is_hex (byte)</a></td> + <td class="summary">Obvious.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#merge">merge (...)</a></td> + <td class="summary">Merge two tables.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#parse_hex">parse_hex (byte)</a></td> + <td class="summary">Obvious.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#percent_or_hex">percent_or_hex (v)</a></td> + <td class="summary">Obvious.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "byte_is_alphanumeric"></a> + <strong>byte_is_alphanumeric (byte)</strong> + </dt> + <dd> + Obvious. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">byte</span> + number + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + boolean + </ol> + + + + +</dd> + <dt> + <a name = "byte_is_hex"></a> + <strong>byte_is_hex (byte)</strong> + </dt> + <dd> + Obvious. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">byte</span> + number + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + boolean + </ol> + + + + +</dd> + <dt> + <a name = "merge"></a> + <strong>merge (...)</strong> + </dt> + <dd> + Merge two tables. </p> + +<p> todo: Remove this and use <code>vim.tbl_deep_extend</code> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + + + + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + table + </ol> + + + + +</dd> + <dt> + <a name = "parse_hex"></a> + <strong>parse_hex (byte)</strong> + </dt> + <dd> + Obvious. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">byte</span> + number + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + number + </ol> + + + + +</dd> + <dt> + <a name = "percent_or_hex"></a> + <strong>percent_or_hex (v)</strong> + </dt> + <dd> + Obvious. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">v</span> + string + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + number|nil + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</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-03 17:24:13 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> |