aboutsummaryrefslogtreecommitdiff
path: root/doc/modules/colorizer.html
blob: e02633cd0cafb4a9dce385e344fd36a4922c4856 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
<!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><strong>colorizer</strong></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>

<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>
    <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 &apos;colorizer&apos;.setup()`

 Highlight using all css highlight modes in every filetype

       `lua require &apos;colorizer&apos;.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 &lt;pre&gt;
           require(&quot;colorizer&quot;).attach_to_buffer(0, {
             mode = &quot;background&quot;,
             css = false,
           })
&lt;/pre&gt;
       Detach from buffer &lt;pre&gt;
           require(&quot;colorizer&quot;).detach_from_buffer(0, {
             mode = &quot;background&quot;,
             css = false,
           })
&lt;/pre&gt;
</pre>
    </ul>
    <h3>Info:</h3>
    <ul>
        <li><strong>Author</strong>: Ashkan Kiani <a href="&#x6d;&#97;&#x69;&#108;&#x74;&#111;&#x3a;f&#114;&#x6f;&#109;&#x2d;&#110;&#x76;&#105;&#x6d;-&#99;&#x6f;&#108;&#x6f;&#114;&#x69;&#122;&#x65;&#114;&#x2e;l&#117;&#x61;&#64;&#x6b;&#105;&#x61;&#110;&#x69;.&#105;&#x6f;">&#x66;&#114;&#x6f;&#109;&#x2d;&#110;&#x76;i&#109;&#x2d;&#99;&#x6f;&#108;&#x6f;&#114;&#x69;z&#101;&#x72;&#46;&#x6c;&#117;&#x61;&#64;&#x6b;&#105;&#x61;n&#105;&#x2e;&#105;&#x6f;</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 ()</a></td>
	<td class="summary">Highlight the buffer region</td>
	</tr>
	<tr>
	<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, ns)</a></td>
	<td class="summary">Stop highlighting the current buffer.</td>
	</tr>
	<tr>
	<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="#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="#Tables">Tables</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#user_default_options">user_default_options</a></td>
	<td class="summary">defaults options.</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">colorizer.buffer_utils.highlight_buffer</a> and <a href="../modules/colorizer.html#attach_to_buffer">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 ()</strong>
    </dt>
    <dd>
    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>
         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#highlight_buffer">highlight_buffer</a>
    </ul>


</dd>
    <dt>
    <a name = "detach_from_buffer"></a>
    <strong>detach_from_buffer (buf, ns)</strong>
    </dt>
    <dd>
    Stop highlighting the current buffer.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">buf</span>
         number|nil: buf A value of 0 or nil implies the current buffer.
        </li>
        <li><span class="parameter">ns</span>
         number|nil: ns the namespace id, if not given DEFAULT_NAMESPACE is used
        </li>
    </ul>





</dd>
    <dt>
    <a name = "attach_to_buffer"></a>
    <strong>attach_to_buffer (buf, options, typ)</strong>
    </dt>
    <dd>
    Attach to a buffer and continuously highlight changes.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">buf</span>
         integer: A value of 0 implies the current buffer.
        </li>
        <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>





</dd>
    <dt>
    <a name = "setup"></a>
    <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>

<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,
      -- all the sub-options of filetypes apply to buftypes
      buftypes = {},
    }
</pre>

<p>For all user<em>default</em>options, see |user<em>default</em>options|


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">config</span>
         table: Config containing above parameters.
        </li>
    </ul>




    <h3>Usage:</h3>
    <ul>
        <pre class="example"><span class="backtick"><code>require&apos;colorizer&apos;.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>
    <dd>
    Reload all of the currently active highlighted buffers.







</dd>
    <dt>
    <a name = "clear_highlight_cache"></a>
    <strong>clear_highlight_cache ()</strong>
    </dt>
    <dd>
    Clear the highlight cache and reload all buffers.







</dd>
</dl>
    <h2 class="section-header "><a name="Tables"></a>Tables</h2>

    <dl class="function">
    <dt>
    <a name = "user_default_options"></a>
    <strong>user_default_options</strong>
    </dt>
    <dd>

<p>defaults options. </p>

<pre>
  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.
      -- Available methods are false / "normal" / "lsp" / "both"
      tailwind = false -- Enable tailwind colors
      virtualtext = "■",
  }
</pre>




    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">RGB</span>
         boolean
        </li>
        <li><span class="parameter">RRGGBB</span>
         boolean
        </li>
        <li><span class="parameter">names</span>
         boolean
        </li>
        <li><span class="parameter">RRGGBBAA</span>
         boolean
        </li>
        <li><span class="parameter">AARRGGBB</span>
         boolean
        </li>
        <li><span class="parameter">rgb_fn</span>
         boolean
        </li>
        <li><span class="parameter">hsl_fn</span>
         boolean
        </li>
        <li><span class="parameter">css</span>
         boolean
        </li>
        <li><span class="parameter">css_fn</span>
         boolean
        </li>
        <li><span class="parameter">mode</span>
         string
        </li>
        <li><span class="parameter">tailwind</span>
         boolean|string
        </li>
        <li><span class="parameter">virtualtext</span>
         string
        </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">colorizer.buffer_utils.highlight_buffer</a> and <a href="../modules/colorizer.html#attach_to_buffer">attach_to_buffer</a>.





    <h3>See also:</h3>
    <ul>
         <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>


</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-06 15:06:04 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>