forked from uga-rosa/ccc.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathccc.txt
635 lines (477 loc) · 18.3 KB
/
ccc.txt
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
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
*ccc.txt* Create Color Code in neovim.
==============================================================================
Contents *ccc-contents*
Introduction |ccc-introduction|
Setup |ccc-setup|
Option |ccc-option|
Command |ccc-command|
Key mapping |ccc-key-mapping|
Variable |ccc-variable|
Autocmd |ccc-autocmd|
Action |ccc-action|
==============================================================================
Introduction *ccc-introduction*
Use the colorful sliders, easy, to create any color you want!
Features:
- No dependency.
- RGB, HSL, CMYK, and other color space sliders for color creation.
- Dynamic highlighting of sliders.
- Restore previously used colors.
- Selectable output formats.
- Transparent slider for css functions (e.g. `rgb()`, `hsl()`)
- Fast colorizer.
==============================================================================
Setup *ccc-setup*
If you do not change the default setting, there is no need to call setup.
See |ccc-option| for the options that can be used.
>
-- Enable true color
vim.opt.termguicolors = true
local ccc = require("ccc")
local mapping = ccc.mapping
ccc.setup({
-- Your preferred settings
-- Example: enable highlighter
highlighter = {
auto_enable = true,
lsp = true,
},
})
<
==============================================================================
Option *ccc-option*
*ccc-option-default-color*
default_color ~
string
Default: "#000000"
The default color used when a color cannot be picked. It must be HEX
format. See also |ccc-option-preserve|.
*ccc-option-bar-char*
bar_char ~
string
Default: "█"
The character used for the sliders.
*ccc-option-point-char*
point_char ~
string
Default: "◊"
The character used for the cursor point on the sliders.
*ccc-option-point-color*
point_color ~
string
Default: ""
The color of the cursor point on the sliders. It must be HEX format.
If it is empty string (""), like the other part of the sliders, it is
dynamically highlighted.
*ccc-option-bar-len*
bar_len ~
integer
Default: 30
The length of the slider (not byte length). This value number of
bar_chars form a slider.
*ccc-option-win-opts*
win_opts ~
table
Default: {
relative = "cursor",
row = 1,
col = 1,
style = "minimal",
border = "rounded",
}
The options passed to the |nvim_open_win|. 'width' and 'height' cannot
be specified.
*ccc-option-auto-close*
auto_close ~
boolean
Default: true
If true, then leaving the ccc UI will automatically close the window.
*ccc-option-preserve*
preserve ~
boolean
Default: false
Whether to preserve the colors when the UI is closed. If this is true,
you can start where you left off last time.
*ccc-option-save-on-quit*
save_on_quit ~
boolean
Default: false
Whether to add colors to prev_colors when quit (|ccc-action-quit|).
*ccc-option-alpha-show*
alpha_show ~
"auto" | "show" | "hide"
Default: "auto"
This option determines whether the alpha slider is displayed when the
UI is opened. "show" and "hide" mean as they are. "auto" makes the
slider appear only when the alpha value can be picked up.
*ccc-option-inputs*
inputs ~
table
Default: {
ccc.input.rgb,
ccc.input.hsl,
ccc.input.cmyk,
}
List of color system to be activated. |ccc-action-toggle-input-mode|
toggles in this order. The first one is the default used at the first
startup. Once activated, it will keep the previous input mode.
The presets currently available are as follows:
- RGB ccc.input.rgb
- HSL ccc.input.hsl
- HWB ccc.input.hwb
- Lab ccc.input.lab
- LCH ccc.input.lch
- OKLab ccc.input.oklab
- OKLCH ccc.input.oklch
- CMYK ccc.input.cmyk
- HSLuv ccc.input.hsluv
- OKHSL ccc.input.okhsl
- HSV ccc.input.hsv
- OKHSV ccc.input.okhsv
- XYZ ccc.input.xyz
*ccc-option-outputs*
outputs ~
table
Default: {
ccc.output.hex,
ccc.output.hex_short,
ccc.output.css_rgb,
ccc.output.css_hsl,
}
List of output format to be activated. |ccc-action-toggle-output-mode|
toggles in this order. The first one is the default used at the first
startup. Once activated, it will keep the previous output mode.
The presets currently available are as follows:
- HEX (6/8 digits) ccc.output.hex
(3/4 digits) ccc.output.hex_short
- CssRGB ccc.output.css_rgb
- CssHSL ccc.output.css_hsl
- CssHWB ccc.output.css_hwb
- CssLab ccc.output.css_lab
- CssLCH ccc.output.css_lch
- CssOKLab ccc.output.css_oklab
- CssOKLCH ccc.output.css_oklch
- Float ccc.output.float
*ccc-option-pickers*
pickers ~
table
Default: {
ccc.picker.hex,
ccc.picker.css_rgb,
ccc.picker.css_hsl,
ccc.picker.css_hwb,
ccc.picker.css_lab,
ccc.picker.css_lch,
ccc.picker.css_oklab,
ccc.picker.css_oklch,
}
List of formats that can be detected by |:CccPick| to be activated.
The presets currently available are as follows:
- HEX ccc.picker.hex
- CssRGB ccc.picker.css_rgb
- CssHSL ccc.picker.css_hsl
- CssHWB ccc.picker.css_hwb
- CssLab ccc.picker.css_lab,
- CssLCH ccc.picker.css_lch,
- CssOKLab ccc.picker.css_oklab,
- CssOKLCH ccc.picker.css_oklch,
- CssName ccc.picker.css_name
Css* conforms to CSS Color Module Level 4.
https://www.w3.org/TR/css-color-4/
*ccc-option-pickers-custom_entries*
There is a special picker named `ccc.picker.custom_entries`. You can
define a table to convert from any word to a specific RGB color.
>
ccc.setup({
pickers = {
ccc.picker.custom_entries({
red = "#ff0000",
green = "#00ff00",
}),
},
})
<
This makes it highlight words both `red` and `green` to supplied RGB
colors. Also you can use them in |:CccPick|.
It detects word boundaries not to highlight words including supplied
characters. So it does not highlight `red` in `Alfred`. This is achieved
by Vim's |/\<| and |/\>| patterns, so it is affected by |'iskeyword'|.
You cannot use any special character for RegExp patterns. When you use
them such as `%`, `[]`, and `^$`, it detects the characters as they are.
*ccc-option-highlight-mode*
highlight_mode ~
"fg" | "bg" | "foreground" | "background"
Default: "bg"
Option to highlight text foreground or background. It is used to
output_line and highlighter.
*ccc-option-output-line*
output_line ~
function
Default: ccc.output_line
This function is used to create a row below the slider that displays
the colors before and after the change. See source code for details.
*ccc-option-highlighter*
highlighter ~
table
These are settings for CccHighlighter.
*ccc-option-highlighter-auto-enable*
highlighter.auto_enable ~
boolean
Default: false
Whether to enable automatically on BufEnter.
*ccc-option-highlighter-max-byte*
highlighter.max_byte ~
integer
Default: 100 * 1024 (100 KB)
The maximum buffer size for which highlight is enabled by
|ccc-option-highlighter-auto-enable|.
*ccc-option-highlighter-filetypes*
highlighter.filetypes ~
string[]
Default: {}
File types for which highlighting is enabled. It is only used for
automatic highlighting by |ccc-option-highlighter-auto-enable|, and is
ignored for manual activation. An empty table means all file types.
*ccc-option-highlighter-excludes*
highlighter.excludes ~
string[]
Default: {}
Used only when |ccc-option-highlighter-filetypes| is empty table. You
can specify file types to be excludes.
*ccc-option-highlighter-lsp*
highlighter.lsp ~
boolean
Default: true
If true, highlight using textDocument/documentColor. If LS with the
color provider is not attached to a buffer, it falls back to highlight
with pickers. The color informations returned by LS are saved and used
by |:CccPick|.
*ccc-option-convert*
convert ~
table
Default: {
{ ccc.picker.hex, ccc.output.css_rgb },
{ ccc.picker.css_rgb, ccc.output.css_hsl },
{ ccc.picker.css_hsl, ccc.output.hex },
}
Specify the correspondence between picker and output. The default
setting converts the color to css_rgb if it is in hex format, to
css_hsl if it is in css_rgb format, and to hex if it is in css_hsl
format.
*ccc-option-recognize*
recognize ~
table
These are settings for recognize color format.
*ccc-option-recognize-input*
recognize.input ~
boolean
Default: false
If true, doing |:CccPick|, it recognizes the color format and
automatically adjusts the input to it. If that format is not
registered in |ccc-option-inputs|, it will fall back to the first one.
*ccc-option-recognize-output*
recognize.output ~
boolean
Default: false
If true, doing |:CccPick|, it recognizes the color format and
automatically adjusts the output to it. If that format is not
registered in |ccc-option-outputs|, it will fall back to the first one.
*ccc-option-recognize-pattern*
recognize.pattern ~
table
Default: {
[picker.css_rgb] = { input.rgb, output.rgb },
[picker.css_name] = { input.rgb, output.rgb },
[picker.hex] = { input.rgb, output.hex },
[picker.css_hsl] = { input.hsl, output.css_hsl },
[picker.css_hwb] = { input.hwb, output.css_hwb },
[picker.css_lab] = { input.lab, output.css_lab },
[picker.css_lch] = { input.lch, output.css_lch },
[picker.css_oklab] = { input.oklab, output.css_oklab },
[picker.css_oklch] = { input.oklch, output.css_oklch },
}
Define the correspondence between the picker and input, output.
*ccc-option-disable-default-mappings*
disable_default_mappings ~
boolean
Default: false
If true, all default mappings are disabled.
*ccc-option-mappings*
mappings ~
table
Default: See |ccc-action|
The mappings are set in the UI of ccc. The table where lhs is key and
rhs is value. To disable all default mappings, use
|ccc-option-disable-default-mappings|. To disable only some of the
default mappings, set ccc.mapping.none.
>
local ccc = require("ccc")
local mapping = ccc.mapping
ccc.setup({
-- Disable all default mappings
-- disable_default_mappings = true
mappings = {
-- Disable only 'q' (|ccc-action-quit|)
q = mapping.none
}
})
<
==============================================================================
Command *ccc-command*
*:CccPick*
:CccPick ~
Detects and replaces the color under the cursor. Detectable formats
are defined in |ccc-option-pickers|. If nothing is detected, the color
is inserted at a cursor position.
*:CccConvert*
:CccConvert ~
Convert color formats directly without opening the UI. The conversion
rules are specified in |ccc-option-convert|.
*:CccHighlighterEnable*
:CccHighlighterEnable ~
Highlight colors in the buffer. The colors to be highlighted are those
returned by textDocument/documentColor request or those registered in
|ccc-option-pickers|.
Highlight is managed on a buffer-by-buffer basis, so you must use this
command each time to enable highlight on a new buffer. You can use
|ccc-option-highlighter-auto-enable| to enable automatically on
|BufEnter|.
The following options are available.
|ccc-option-highlighter-auto-enable|
|ccc-option-highlighter-filetypes|
|ccc-option-highlighter-excludes|
|ccc-option-highlighter-lsp|
*:CccHighlighterDisable*
:CccHighlighterDisable ~
Disable highlight.
*:CccHighlighterToggle*
:CccHighlighterToggle ~
Toggle highlight.
==============================================================================
Key mapping *ccc-key-mapping*
*<Plug>(ccc-insert)*
<Plug>(ccc-insert) ~
Defined in insert mode. Insert the color without detection.
==============================================================================
Variable *ccc-variable*
*g:ccc_color*
g:ccc_color ~
The color currently being edited is stored in HEX format. If the ccc
UI is not open, it is empty string ("").
==============================================================================
Autocmd *ccc-autocmd*
*CccColorChanged*
CccColorChanged ~
After changing |g:ccc_color|.
==============================================================================
Highlight *ccc-highlight*
*CccFloatNormal* *hl-CccFloatNormal*
CccFloatNormal ~
The highlight for float window.
*CccFloatBorder* *hl-CccFloatBorder*
CccFloatBorder ~
The highlight for float window border.
==============================================================================
Action *ccc-action*
All actions are implemented as lua functions.
To customize, use |ccc-option-mappings|.
>
local ccc = require("ccc")
local mapping = ccc.mapping
<
*ccc-action-complete*
complete ~
mapping.complete()
Default mapping: <CR>
Close the UI and perform a replace or insert.
If open the previous colors pallet, select the color under the cursor.
*ccc-action-quit*
quit ~
mapping.quit()
Default mapping: q
Alias of |:quit|. Cancel and close the UI without replace or insert.
*ccc-action-toggle-input-mode*
toggle_input_mode ~
mapping.toggle_input_mode()
Default mapping: i
Toggle input mode. See |ccc-option-inputs|.
*ccc-action-toggle-output-mode*
toggle_output_mode ~
mapping.toggle_output_mode()
Default mapping: o
Toggle output mode. See |ccc-option-outputs|.
*ccc-action-toggle-alpha*
toggle_alpha ~
mapping.toggle_alpha()
Default mapping: a
Toggle show/hide alpha (transparency) slider.
*ccc-action-toggle-prev-colors*
toggle_prev_colors ~
mapping.toggle_prev_colors()
Default mapping: g
Toggle show and hide the previous colors pallet.
Use the following to move colors.
- |ccc-action-goto-next|
- |ccc-action-goto-prev|
- |ccc-action-goto-tail|
- |ccc-action-goto-head|
*ccc-action-show-prev-colors*
toggle_prev_colors ~
mapping.show_prev_colors()
Default mapping is nothing.
Show the previous colors pallet.
*ccc-action-hide-prev-colors*
toggle_prev_colors ~
mapping.hide_prev_colors()
Default mapping is nothing.
Hide the previous colors pallet.
*ccc-action-goto-next*
goto_next ~
mapping.goto_next()
Default mapping: w
Go to next (right) color.
*ccc-action-goto-prev*
goto_prev ~
mapping.goto_prev()
Default mapping: b
Go to previous (left) color.
*ccc-action-goto-tail*
goto_tail ~
mapping.goto_tail()
Default mapping: W
Go to the last color.
*ccc-action-goto-head*
goto_head ~
mapping.goto_head()
Default mapping: B
Go to the first color.
*ccc-action-increase* *ccc-action-increase1*
*ccc-action-increase5* *ccc-action-increase10*
increase ~
mapping.increase1()
mapping.increase5()
mapping.increase10()
mapping.delta(intger)
Default mapping: l / d / , (1 / 5 / 10)
Increase the value times delta of the slider.
The delta is defined each color system, e.g. RGB is 1.
*ccc-action-decrease* *ccc-action-decrease1*
*ccc-action-decrease5* *ccc-action-decrease10*
decrease ~
mapping.decrease1()
mapping.decrease5()
mapping.decrease10()
mapping.delta(intger)
Default mapping: h / s / m (1 / 5 / 10)
Decrease the value times delta of the slider.
The delta is defined each color system, e.g. RGB is 1.
*ccc-action-set* *ccc-action-set0*
*ccc-action-set50* *ccc-action-set100*
set ~
mapping.set0()
mapping.set50()
mapping.set100()
ccc.set_percent(integer)
Default mapping: H / M / L (0 / 50 / 100), 1 - 9 (10% - 90%)
Set the value of the slider as a percentage.
vim:tw=78:ts=8:noet:ft=help:norl: