retrovim 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/.conda/retrovim.yaml +259 -0
  2. package/.conda/terax.icns +0 -0
  3. package/.conda/terax.ico +0 -0
  4. package/.conda/terax.png +0 -0
  5. package/.github/workflows/release.yml +95 -0
  6. package/.gitmodules +3 -0
  7. package/.npm/kanata_touchcursor.js +28 -0
  8. package/.npm/nvim.js +26 -0
  9. package/.npm/yazi.js +26 -0
  10. package/.npm/zsh.js +17 -0
  11. package/.pip/kanata_touchcursor/__init__.py +28 -0
  12. package/.pip/nvim/__init__.py +31 -0
  13. package/.pip/yazi/__init__.py +31 -0
  14. package/.pip/zsh/__init__.py +22 -0
  15. package/CHANGELOG.md +26 -0
  16. package/LICENSE +674 -0
  17. package/README.md +336 -0
  18. package/kanata/touchcursor.kbd +164 -0
  19. package/nvim/init.lua +813 -0
  20. package/nvim/plugins/mini.nvim/.github/DISCUSSION_TEMPLATE/q-a.yml +72 -0
  21. package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/bug-report.yml +136 -0
  22. package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/config.yml +5 -0
  23. package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/feature-request.yml +75 -0
  24. package/nvim/plugins/mini.nvim/.github/PULL_REQUEST_TEMPLATE.md +2 -0
  25. package/nvim/plugins/mini.nvim/.github/workflows/quality-control.yml +150 -0
  26. package/nvim/plugins/mini.nvim/.pre-commit-config.yaml +20 -0
  27. package/nvim/plugins/mini.nvim/.stylua.toml +7 -0
  28. package/nvim/plugins/mini.nvim/.styluaignore +1 -0
  29. package/nvim/plugins/mini.nvim/CHANGELOG.md +1894 -0
  30. package/nvim/plugins/mini.nvim/CODE_OF_CONDUCT.md +132 -0
  31. package/nvim/plugins/mini.nvim/CONTRIBUTING.md +331 -0
  32. package/nvim/plugins/mini.nvim/LICENSE +21 -0
  33. package/nvim/plugins/mini.nvim/MAINTAINING.md +330 -0
  34. package/nvim/plugins/mini.nvim/Makefile +51 -0
  35. package/nvim/plugins/mini.nvim/README.md +261 -0
  36. package/nvim/plugins/mini.nvim/TESTING.md +1011 -0
  37. package/nvim/plugins/mini.nvim/benchmarks/starter/README.md +35 -0
  38. package/nvim/plugins/mini.nvim/benchmarks/starter/benchmark.sh +56 -0
  39. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-alpha.lua +21 -0
  40. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-original.lua +17 -0
  41. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-starter.lua +18 -0
  42. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_empty.lua +4 -0
  43. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_starter-default.lua +7 -0
  44. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-alpha.lua +10 -0
  45. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-original.lua +7 -0
  46. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-starter.lua +20 -0
  47. package/nvim/plugins/mini.nvim/benchmarks/starter/install.sh +10 -0
  48. package/nvim/plugins/mini.nvim/benchmarks/starter/make_summary.py +68 -0
  49. package/nvim/plugins/mini.nvim/benchmarks/starter/startup-summary.md +10 -0
  50. package/nvim/plugins/mini.nvim/colors/miniautumn.lua +55 -0
  51. package/nvim/plugins/mini.nvim/colors/minicyan.lua +95 -0
  52. package/nvim/plugins/mini.nvim/colors/minischeme.lua +95 -0
  53. package/nvim/plugins/mini.nvim/colors/minispring.lua +53 -0
  54. package/nvim/plugins/mini.nvim/colors/minisummer.lua +49 -0
  55. package/nvim/plugins/mini.nvim/colors/miniwinter.lua +51 -0
  56. package/nvim/plugins/mini.nvim/colors/randomhue.lua +16 -0
  57. package/nvim/plugins/mini.nvim/doc/mini-ai.txt +889 -0
  58. package/nvim/plugins/mini.nvim/doc/mini-align.txt +923 -0
  59. package/nvim/plugins/mini.nvim/doc/mini-animate.txt +937 -0
  60. package/nvim/plugins/mini.nvim/doc/mini-base16.txt +285 -0
  61. package/nvim/plugins/mini.nvim/doc/mini-basics.txt +359 -0
  62. package/nvim/plugins/mini.nvim/doc/mini-bracketed.txt +622 -0
  63. package/nvim/plugins/mini.nvim/doc/mini-bufremove.txt +123 -0
  64. package/nvim/plugins/mini.nvim/doc/mini-clue.txt +760 -0
  65. package/nvim/plugins/mini.nvim/doc/mini-cmdline.txt +392 -0
  66. package/nvim/plugins/mini.nvim/doc/mini-colors.txt +880 -0
  67. package/nvim/plugins/mini.nvim/doc/mini-comment.txt +230 -0
  68. package/nvim/plugins/mini.nvim/doc/mini-completion.txt +477 -0
  69. package/nvim/plugins/mini.nvim/doc/mini-cursorword.txt +105 -0
  70. package/nvim/plugins/mini.nvim/doc/mini-deps.txt +590 -0
  71. package/nvim/plugins/mini.nvim/doc/mini-diff.txt +661 -0
  72. package/nvim/plugins/mini.nvim/doc/mini-doc.txt +434 -0
  73. package/nvim/plugins/mini.nvim/doc/mini-extra.txt +856 -0
  74. package/nvim/plugins/mini.nvim/doc/mini-files.txt +1018 -0
  75. package/nvim/plugins/mini.nvim/doc/mini-fuzzy.txt +160 -0
  76. package/nvim/plugins/mini.nvim/doc/mini-git.txt +425 -0
  77. package/nvim/plugins/mini.nvim/doc/mini-hipatterns.txt +489 -0
  78. package/nvim/plugins/mini.nvim/doc/mini-hues.txt +420 -0
  79. package/nvim/plugins/mini.nvim/doc/mini-icons.txt +508 -0
  80. package/nvim/plugins/mini.nvim/doc/mini-indentscope.txt +485 -0
  81. package/nvim/plugins/mini.nvim/doc/mini-input.txt +932 -0
  82. package/nvim/plugins/mini.nvim/doc/mini-jump.txt +202 -0
  83. package/nvim/plugins/mini.nvim/doc/mini-jump2d.txt +525 -0
  84. package/nvim/plugins/mini.nvim/doc/mini-keymap.txt +449 -0
  85. package/nvim/plugins/mini.nvim/doc/mini-map.txt +717 -0
  86. package/nvim/plugins/mini.nvim/doc/mini-misc.txt +431 -0
  87. package/nvim/plugins/mini.nvim/doc/mini-move.txt +181 -0
  88. package/nvim/plugins/mini.nvim/doc/mini-notify.txt +434 -0
  89. package/nvim/plugins/mini.nvim/doc/mini-nvim.txt +431 -0
  90. package/nvim/plugins/mini.nvim/doc/mini-operators.txt +472 -0
  91. package/nvim/plugins/mini.nvim/doc/mini-pairs.txt +346 -0
  92. package/nvim/plugins/mini.nvim/doc/mini-pick.txt +1535 -0
  93. package/nvim/plugins/mini.nvim/doc/mini-sessions.txt +239 -0
  94. package/nvim/plugins/mini.nvim/doc/mini-snippets.txt +1291 -0
  95. package/nvim/plugins/mini.nvim/doc/mini-splitjoin.txt +536 -0
  96. package/nvim/plugins/mini.nvim/doc/mini-starter.txt +618 -0
  97. package/nvim/plugins/mini.nvim/doc/mini-statusline.txt +361 -0
  98. package/nvim/plugins/mini.nvim/doc/mini-surround.txt +863 -0
  99. package/nvim/plugins/mini.nvim/doc/mini-tabline.txt +151 -0
  100. package/nvim/plugins/mini.nvim/doc/mini-test.txt +966 -0
  101. package/nvim/plugins/mini.nvim/doc/mini-trailspace.txt +91 -0
  102. package/nvim/plugins/mini.nvim/doc/mini-visits.txt +937 -0
  103. package/nvim/plugins/mini.nvim/logo.png +0 -0
  104. package/nvim/plugins/mini.nvim/lua/mini/ai.lua +2244 -0
  105. package/nvim/plugins/mini.nvim/lua/mini/align.lua +2076 -0
  106. package/nvim/plugins/mini.nvim/lua/mini/animate.lua +2127 -0
  107. package/nvim/plugins/mini.nvim/lua/mini/base16.lua +1752 -0
  108. package/nvim/plugins/mini.nvim/lua/mini/basics.lua +772 -0
  109. package/nvim/plugins/mini.nvim/lua/mini/bracketed.lua +2013 -0
  110. package/nvim/plugins/mini.nvim/lua/mini/bufremove.lua +283 -0
  111. package/nvim/plugins/mini.nvim/lua/mini/clue.lua +2096 -0
  112. package/nvim/plugins/mini.nvim/lua/mini/cmdline.lua +1182 -0
  113. package/nvim/plugins/mini.nvim/lua/mini/colors.lua +2483 -0
  114. package/nvim/plugins/mini.nvim/lua/mini/comment.lua +586 -0
  115. package/nvim/plugins/mini.nvim/lua/mini/completion.lua +2094 -0
  116. package/nvim/plugins/mini.nvim/lua/mini/cursorword.lua +311 -0
  117. package/nvim/plugins/mini.nvim/lua/mini/deps.lua +1660 -0
  118. package/nvim/plugins/mini.nvim/lua/mini/diff.lua +1938 -0
  119. package/nvim/plugins/mini.nvim/lua/mini/doc.lua +1371 -0
  120. package/nvim/plugins/mini.nvim/lua/mini/extra.lua +2290 -0
  121. package/nvim/plugins/mini.nvim/lua/mini/files.lua +3145 -0
  122. package/nvim/plugins/mini.nvim/lua/mini/fuzzy.lua +356 -0
  123. package/nvim/plugins/mini.nvim/lua/mini/git.lua +1737 -0
  124. package/nvim/plugins/mini.nvim/lua/mini/hipatterns.lua +1042 -0
  125. package/nvim/plugins/mini.nvim/lua/mini/hues.lua +2088 -0
  126. package/nvim/plugins/mini.nvim/lua/mini/icons.lua +2254 -0
  127. package/nvim/plugins/mini.nvim/lua/mini/indentscope.lua +1158 -0
  128. package/nvim/plugins/mini.nvim/lua/mini/init.lua +427 -0
  129. package/nvim/plugins/mini.nvim/lua/mini/input.lua +2183 -0
  130. package/nvim/plugins/mini.nvim/lua/mini/jump.lua +609 -0
  131. package/nvim/plugins/mini.nvim/lua/mini/jump2d.lua +1244 -0
  132. package/nvim/plugins/mini.nvim/lua/mini/keymap.lua +880 -0
  133. package/nvim/plugins/mini.nvim/lua/mini/map.lua +1709 -0
  134. package/nvim/plugins/mini.nvim/lua/mini/misc.lua +969 -0
  135. package/nvim/plugins/mini.nvim/lua/mini/move.lua +509 -0
  136. package/nvim/plugins/mini.nvim/lua/mini/notify.lua +938 -0
  137. package/nvim/plugins/mini.nvim/lua/mini/operators.lua +1349 -0
  138. package/nvim/plugins/mini.nvim/lua/mini/pairs.lua +657 -0
  139. package/nvim/plugins/mini.nvim/lua/mini/pick.lua +3876 -0
  140. package/nvim/plugins/mini.nvim/lua/mini/sessions.lua +689 -0
  141. package/nvim/plugins/mini.nvim/lua/mini/snippets.lua +2828 -0
  142. package/nvim/plugins/mini.nvim/lua/mini/splitjoin.lua +1132 -0
  143. package/nvim/plugins/mini.nvim/lua/mini/starter.lua +1599 -0
  144. package/nvim/plugins/mini.nvim/lua/mini/statusline.lua +686 -0
  145. package/nvim/plugins/mini.nvim/lua/mini/surround.lua +2388 -0
  146. package/nvim/plugins/mini.nvim/lua/mini/tabline.lua +564 -0
  147. package/nvim/plugins/mini.nvim/lua/mini/test.lua +2516 -0
  148. package/nvim/plugins/mini.nvim/lua/mini/trailspace.lua +215 -0
  149. package/nvim/plugins/mini.nvim/lua/mini/visits.lua +1577 -0
  150. package/nvim/plugins/mini.nvim/readmes/mini-ai.md +190 -0
  151. package/nvim/plugins/mini.nvim/readmes/mini-align.md +203 -0
  152. package/nvim/plugins/mini.nvim/readmes/mini-animate.md +214 -0
  153. package/nvim/plugins/mini.nvim/readmes/mini-base16.md +198 -0
  154. package/nvim/plugins/mini.nvim/readmes/mini-basics.md +184 -0
  155. package/nvim/plugins/mini.nvim/readmes/mini-bracketed.md +193 -0
  156. package/nvim/plugins/mini.nvim/readmes/mini-bufremove.md +139 -0
  157. package/nvim/plugins/mini.nvim/readmes/mini-clue.md +260 -0
  158. package/nvim/plugins/mini.nvim/readmes/mini-cmdline.md +183 -0
  159. package/nvim/plugins/mini.nvim/readmes/mini-colors.md +169 -0
  160. package/nvim/plugins/mini.nvim/readmes/mini-comment.md +183 -0
  161. package/nvim/plugins/mini.nvim/readmes/mini-completion.md +217 -0
  162. package/nvim/plugins/mini.nvim/readmes/mini-cursorword.md +137 -0
  163. package/nvim/plugins/mini.nvim/readmes/mini-deps.md +271 -0
  164. package/nvim/plugins/mini.nvim/readmes/mini-diff.md +289 -0
  165. package/nvim/plugins/mini.nvim/readmes/mini-doc.md +198 -0
  166. package/nvim/plugins/mini.nvim/readmes/mini-extra.md +158 -0
  167. package/nvim/plugins/mini.nvim/readmes/mini-files.md +247 -0
  168. package/nvim/plugins/mini.nvim/readmes/mini-fuzzy.md +134 -0
  169. package/nvim/plugins/mini.nvim/readmes/mini-git.md +168 -0
  170. package/nvim/plugins/mini.nvim/readmes/mini-hipatterns.md +176 -0
  171. package/nvim/plugins/mini.nvim/readmes/mini-hues.md +285 -0
  172. package/nvim/plugins/mini.nvim/readmes/mini-icons.md +183 -0
  173. package/nvim/plugins/mini.nvim/readmes/mini-indentscope.md +191 -0
  174. package/nvim/plugins/mini.nvim/readmes/mini-input.md +163 -0
  175. package/nvim/plugins/mini.nvim/readmes/mini-jump.md +161 -0
  176. package/nvim/plugins/mini.nvim/readmes/mini-jump2d.md +197 -0
  177. package/nvim/plugins/mini.nvim/readmes/mini-keymap.md +205 -0
  178. package/nvim/plugins/mini.nvim/readmes/mini-map.md +191 -0
  179. package/nvim/plugins/mini.nvim/readmes/mini-misc.md +145 -0
  180. package/nvim/plugins/mini.nvim/readmes/mini-move.md +163 -0
  181. package/nvim/plugins/mini.nvim/readmes/mini-notify.md +175 -0
  182. package/nvim/plugins/mini.nvim/readmes/mini-operators.md +193 -0
  183. package/nvim/plugins/mini.nvim/readmes/mini-pairs.md +158 -0
  184. package/nvim/plugins/mini.nvim/readmes/mini-pick.md +340 -0
  185. package/nvim/plugins/mini.nvim/readmes/mini-sessions.md +164 -0
  186. package/nvim/plugins/mini.nvim/readmes/mini-snippets.md +373 -0
  187. package/nvim/plugins/mini.nvim/readmes/mini-splitjoin.md +194 -0
  188. package/nvim/plugins/mini.nvim/readmes/mini-starter.md +176 -0
  189. package/nvim/plugins/mini.nvim/readmes/mini-statusline.md +155 -0
  190. package/nvim/plugins/mini.nvim/readmes/mini-surround.md +190 -0
  191. package/nvim/plugins/mini.nvim/readmes/mini-tabline.md +156 -0
  192. package/nvim/plugins/mini.nvim/readmes/mini-test.md +175 -0
  193. package/nvim/plugins/mini.nvim/readmes/mini-trailspace.md +137 -0
  194. package/nvim/plugins/mini.nvim/readmes/mini-visits.md +243 -0
  195. package/nvim/plugins/mini.nvim/scripts/dual_log.sh +13 -0
  196. package/nvim/plugins/mini.nvim/scripts/dual_push.sh +15 -0
  197. package/nvim/plugins/mini.nvim/scripts/dual_release.sh +102 -0
  198. package/nvim/plugins/mini.nvim/scripts/dual_sync.sh +115 -0
  199. package/nvim/plugins/mini.nvim/scripts/init-deps-example.lua +59 -0
  200. package/nvim/plugins/mini.nvim/scripts/lint-filename-length.sh +16 -0
  201. package/nvim/plugins/mini.nvim/scripts/lintcommit-ci.sh +18 -0
  202. package/nvim/plugins/mini.nvim/scripts/lintcommit.lua +393 -0
  203. package/nvim/plugins/mini.nvim/scripts/minidoc.lua +57 -0
  204. package/nvim/plugins/mini.nvim/scripts/minimal_init.lua +28 -0
  205. package/nvim/plugins/mini.nvim/scripts/minitest.lua +4 -0
  206. package/package.json +16 -0
  207. package/pyproject.toml +43 -0
  208. package/yazi/init.lua +12 -0
  209. package/yazi/keymap.toml +114 -0
  210. package/yazi/lesskey +5 -0
  211. package/yazi/plugins/bookmarks.yazi/main.lua +86 -0
  212. package/yazi/plugins/cd-git-root.yazi/main.lua +31 -0
  213. package/yazi/plugins/smart-enter.yazi/main.lua +11 -0
  214. package/yazi/theme.toml +26 -0
  215. package/yazi/yazi.toml +15 -0
  216. package/zsh/.zshrc +145 -0
  217. package/zsh/starship.toml +20 -0
  218. package/zsh/zsh-patina.toml +2 -0
@@ -0,0 +1,880 @@
1
+ *mini.colors* Tweak and save any color scheme
2
+
3
+ MIT License Copyright (c) 2023 Evgeni Chasnovski
4
+
5
+ ------------------------------------------------------------------------------
6
+ *MiniColors*
7
+ Features:
8
+ - Create colorscheme object: either manually (|MiniColors.as_colorscheme()|)
9
+ or by querying present color schemes (including currently active one; see
10
+ |MiniColors.get_colorscheme()|).
11
+
12
+ - Infer data about color scheme and/or modify based on it:
13
+ - Add transparency by removing background color (requires transparency
14
+ in terminal emulator).
15
+ - Infer cterm attributes (|cterm-colors|) based on gui colors making it
16
+ compatible with |'notermguicolors'|.
17
+ - Resolve highlight group links (|:highlight-link|).
18
+ - Compress by removing redundant highlight groups.
19
+ - Extract palette of used colors and/or infer terminal colors
20
+ (|terminal-config|) based on it.
21
+
22
+ - Modify colors to better fit your taste and/or goals (see more in
23
+ |MiniColors-colorscheme-methods|):
24
+ - Apply any function to color hex string.
25
+ - Update channels (like lightness, saturation, hue, temperature, red,
26
+ green, blue, etc.; see more in |MiniColors-channels|).
27
+ Use either own function or one of the implemented methods:
28
+ - Add value to channel or multiply it by coefficient. Like "add 10
29
+ to saturation of every color" or "multiply saturation by 2" to
30
+ make colors more saturated (less gray).
31
+ - Invert. Like "invert lightness" to convert between dark/light theme.
32
+ - Set to one or more values (picks closest to current one). Like
33
+ "set to one or two hues" to make mono- or dichromatic color scheme.
34
+ - Repel from certain source(s) with stronger effect for closer values.
35
+ Like "repel from hue 30" to remove red color from color scheme.
36
+ Repel hue (how much is removed) is configurable.
37
+ - Simulate color vision deficiency.
38
+
39
+ - Once color scheme is ready, either apply it to see effects right away or
40
+ write it into a Lua file as a fully functioning separate color scheme.
41
+
42
+ - Experiment interactively with a feedback (|MiniColors.interactive()|).
43
+
44
+ - Animate transition between color schemes either with |MiniColors.animate()|
45
+ or with |:Colorscheme| user command.
46
+
47
+ - Convert within supported color spaces (|MiniColors.convert()|):
48
+ - Hex string.
49
+ - 8-bit number (terminal colors).
50
+ - RGB.
51
+ - Oklab, Oklch, Okhsl (https://bottosson.github.io/posts/oklab/).
52
+
53
+ Notes:
54
+ - There is a collection of |MiniColors-recipes| with code snippets for some
55
+ common tasks.
56
+ - There is no goal to support as many color spaces as possible, only the
57
+ already present ones.
58
+
59
+ # Tweak quick start ~
60
+
61
+ - Execute `:lua require('mini.colors').interactive()`.
62
+
63
+ - Experiment by writing calls to exposed color scheme methods and applying
64
+ them with `<M-a>`. For more information, see |MiniColors-colorscheme-methods|
65
+ and |MiniColors-recipes|.
66
+
67
+ - If you are happy with result, write color scheme with `<M-w>`. If not,
68
+ reset to initial color scheme with `<M-r>`.
69
+
70
+ - If only some highlight groups can be made better, adjust them manually
71
+ inside written color scheme file.
72
+
73
+ # Setup ~
74
+
75
+ This module doesn't need setup, but it can be done to improve usability.
76
+ Setup with `require('mini.colors').setup({})` (replace `{}` with your
77
+ `config` table). It will create global Lua table `MiniColors` which you can
78
+ use for scripting or manually (with `:lua MiniColors.*`).
79
+
80
+ See |MiniColors.config| for `config` structure and default values.
81
+
82
+ This module doesn't have runtime options, so using `vim.b.minicolors_config`
83
+ will have no effect here.
84
+
85
+ # Comparisons ~
86
+
87
+ - [rktjmp/lush.nvim](https://github.com/rktjmp/lush.nvim):
88
+ - Oriented towards tweaking separate highlight groups, while |mini.colors|
89
+ is more designed to work with color scheme as a whole.
90
+ - Uses HSL and HSLuv color spaces, while |mini.colors| uses Oklab, Oklch,
91
+ and Okhsl which have slightly better perceptual uniformity properties.
92
+ - Doesn't have functionality to infer and repair missing data in color
93
+ scheme (like cterm attributes, terminal colors, transparency, etc.),
94
+ while |mini.colors| does.
95
+ - Doesn't implement animation of color scheme transition, while
96
+ |mini.colors| does.
97
+ - [lifepillar/vim-colortemplate](https://github.com/lifepillar/vim-colortemplate):
98
+ - Comparisons are similar to that of `rktjmp/lush.nvim`.
99
+ - [tjdevries/colorbuddy.nvim](https://github.com/tjdevries/colorbuddy.nvim):
100
+ - Comparisons are similar to that of `rktjmp/lush.nvim`.
101
+
102
+ ------------------------------------------------------------------------------
103
+ *MiniColors-recipes*
104
+ All following code snippets assume to be executed inside interactive buffer
105
+ (|MiniColors.interactive()|). They are directly copy-pasteable.
106
+
107
+ To apply single method to current color scheme, use >vim
108
+ :lua MiniColors.get_colorscheme():<method goes here>:apply().
109
+ <
110
+ Recipes:
111
+ - Tweak lightness: >lua
112
+
113
+ -- Invert dark/light color scheme to be light/dark
114
+ chan_invert('lightness', { gamut_clip = 'cusp' })
115
+
116
+ -- Ensure constant contrast ratio
117
+ chan_set('lightness', 15, { filter = 'bg' })
118
+ chan_set('lightness', 85, { filter = 'fg' })
119
+ <
120
+ - Tweak saturation: >lua
121
+
122
+ -- Make background colors less saturated and foreground - more
123
+ chan_add('saturation', -20, { filter = 'bg' })
124
+ chan_add('saturation', 20, { filter = 'fg' })
125
+
126
+ -- Convert to grayscale
127
+ chan_set('saturation', 0)
128
+ <
129
+ - Tweak hue: >lua
130
+
131
+ -- Create monochromatic variant (this uses green color)
132
+ chan_set('hue', 135)
133
+
134
+ -- Create dichromatic variant (this uses Neovim-themed hues)
135
+ chan_set('hue', { 140, 245 })
136
+ <
137
+ - Tweak temperature: >lua
138
+
139
+ -- Invert temperature (make cold theme become warm and vice versa)
140
+ chan_invert('temperature')
141
+
142
+ -- Make background colors colder and foreground warmer
143
+ chan_add('temperature', -40, { filter = 'bg' })
144
+ chan_add('temperature', 40, { filter = 'fg' })
145
+ <
146
+ - Counter color vision deficiency (try combinations of these to see which
147
+ one works best for you):
148
+
149
+ - Improve text saturation contrast (usually the best starting approach): >lua
150
+
151
+ chan_set('saturation', { 10, 90 }, { filter = 'fg' })
152
+ <
153
+ - Remove certain hues from all colors (use 30 for red, 90 for yellow,
154
+ 135 for green, 270 for blue): >lua
155
+
156
+ -- Repel red color
157
+ chan_repel('hue', 30, 45)
158
+ <
159
+ - Force equally spaced palette (remove ones with which you know you
160
+ have trouble): >lua
161
+
162
+ -- Might be a good choice for red-green color blindness
163
+ chan_set('hue', { 90, 180, 270})
164
+
165
+ -- Might be a good choice for blue-yellow color blindness
166
+ chan_set('hue', { 0, 90, 180 })
167
+ <
168
+ - Inverting temperature or pressure can sometimes improve readability: >lua
169
+
170
+ chan_invert('temperature')
171
+ chan_invert('pressure')
172
+ <
173
+ - If all hope is lost, hue random generation might help if you are lucky: >lua
174
+
175
+ chan_modify('hue', function() return math.random(0, 359) end)
176
+ <
177
+ - For color scheme creators use |MiniColors-colorscheme:simulate_cvd()| to
178
+ simulate various color vision deficiency types to see how color scheme
179
+ would look in the eyes of color blind person.
180
+
181
+ ------------------------------------------------------------------------------
182
+ *MiniColors-color-spaces*
183
+ Color space is a way to quantitatively describe a color. In this module
184
+ color spaces are used both as source for |MiniColors-channels| and inputs
185
+ for |MiniColors.convert()|
186
+
187
+ List of supported color spaces (along with their id in parenthesis):
188
+ - 8-bit (`8-bit`) - integer between 16 and 255. Usually values 0-15 are also
189
+ supported, but they depend on terminal emulator theme which is not reliable.
190
+ See https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit .
191
+
192
+ - Hex (`hex`) - string of the form "#xxxxxx" where `x` is a hexadecimal number.
193
+
194
+ - RGB (`rgb`) - table with numeric fields `r` (red), `g` (green), `b` (blue).
195
+ Visible range is from 0 to 255.
196
+
197
+ - Oklab (`oklab`) - table with fields `l` (lightness; numeric in [0; 100]),
198
+ `a`, `b` (both are unbounded numeric; visible range is usually between
199
+ -30 to 30). Field `l` describes how light is color; `a` - how "green-red" it is;
200
+ `b` - how "blue-yellow" it is.
201
+
202
+ - Oklch (`oklch`) - table with fields `l` (same as in Oklab),
203
+ `c` (chroma; positive numeric, visible range usually lower than 32),
204
+ `h` (`nil` for grays or periodic numeric in [0, 360)). Field `c` describes how
205
+ colorful a color is; `h` is a value of "true color" on color circle/wheel.
206
+ NOTE: gray colors, being achromatic by nature, don't have hue.
207
+
208
+ - Okhsl (`okhsl`) - Oklch but with `c` replaced by `s` (saturation; numeric
209
+ in [0; 100]). Field `s` describes a percent of chroma relative to maximum
210
+ visible chroma for the particular lightness and hue combination. Note,
211
+ that mathematical model used to compute maximum visible chroma is
212
+ approximate which might lead to inaccuracies for highly saturated colors
213
+ with relatively low or high lightness.
214
+
215
+ Sources for Oklab/Oklch/Okhsl:
216
+ - https://bottosson.github.io/posts/oklab/ - initial derivation and
217
+ introduction of Oklab and Oklch.
218
+ - https://bottosson.github.io/misc/colorpicker - interactive color picker.
219
+ Great way for a hands-on introduction to concepts of lightness, chroma,
220
+ saturation, and hue.
221
+
222
+ Note that Oklab/Oklch/Okhsl use channel normalization for `l`, `a`, `b`, `c`, `s` that
223
+ is more oriented towards integer numbers (according to the above sources).
224
+ Some implementations (like in CSS) are more oriented towards [0; 1] range or
225
+ percentages. Adjust accordingly by dividing/multiplying output by 100.
226
+ Also use `adjust_lightness = false` in |MiniColors.convert()|.
227
+
228
+ # Gamut clip ~
229
+ *MiniColors-gamut-clip*
230
+
231
+ In Neovim highlight group colors are usually specified by their red, green,
232
+ and blue values from 0 to 255 in the form of HEX string (see |gui-colors|).
233
+ Although plenty, these are not all possible colors.
234
+
235
+ When performing color manipulation using |MiniColors-colorscheme-methods|,
236
+ it is possible to end up with "impossible" color (which can't be directly
237
+ converted to HEX string). For example, inverting lightness of color "#fce094"
238
+ will lead to a color `{ l = 10, c = 10, h = 90 }` in Oklch space, i.e.
239
+ "dark yellow" which is impossible to show in HEX.
240
+
241
+ GAMUT CLIPPING is an action of converting color outside of visible gamut
242
+ (colors representable with HEX string) to be inside it while preserving
243
+ certain perceptual characteristics as much as possible.
244
+
245
+ Gamut clipping in this module is done inside Oklch color space. The goal is to
246
+ preserve hue as much as possible while manipulating lightness and/or chroma.
247
+
248
+ List of supported gamut clip methods (along with their id in parenthesis):
249
+ - Clip chroma (`'chroma'`) - reduce chroma while preserving lightness until
250
+ color is inside visible gamut. Default method.
251
+
252
+ - Clip lightness (`'lightness'`) - reduce lightness while preserving chroma
253
+ until color is inside visible gamut.
254
+
255
+ - Clip according to "cusp" (`'cusp'`) - reduce both lightness and chroma in
256
+ a compromise way depending on hue.
257
+ Cusp is a color with the highest chroma inside slice of visible gamut
258
+ with the same hue (hue leaf). It is called that way because the slice has
259
+ a roughly triangular shape with points at (0, 0) - (0, 100) - "cusp" in
260
+ (chroma, lightness) coordinates.
261
+ Gamut clipping using "cusp" as reference is done by changing color towards
262
+ (0, cusp_lightness) point (gray with lightness equal to that of a current
263
+ cusp) until color is inside visible gamut.
264
+
265
+ In short:
266
+ - Usually `'chroma'` is enough.
267
+ - If colors are too desaturated - try `'cusp'`.
268
+ - If still not colorful enough - try `'lightness'`.
269
+
270
+ Notes:
271
+ - Currently implemented formulas are approximate (by design; to reduce code
272
+ complexity) so there might be problems for highly saturated colors with
273
+ relatively low or high lightness.
274
+
275
+ ------------------------------------------------------------------------------
276
+ *MiniColors-channels*
277
+ A color channel is a number describing one particular aspect of a color.
278
+ It is usually direct or modified coordinate of a color space. See
279
+ |MiniColors-color-spaces| for information on color spaces.
280
+
281
+ List of supported channels (along with their id in parenthesis):
282
+ - Lightness (`lightness`) - corrected `l` component of Oklch. Describes how
283
+ light is a color. Ranges from 0 (black dark) to 100 (white light).
284
+
285
+ - Chroma (`chroma`) - `c` component of Oklch. Describes how colorful is
286
+ a color in absolute units. Ranges from 0 (gray) to infinity (more like
287
+ around 30 in practice).
288
+
289
+ - Saturation (`saturation`) - `s` component of Okhsl. Describes how colorful
290
+ is color in relative units. Ranges from 0 (gray) to 100 (maximum saturation
291
+ for a given lightness-hue pair).
292
+
293
+ - Hue (`hue`) - `h` component of Oklch. Describes "true color value" (like
294
+ red/green/blue) as a number. It is a periodic value from 0 (included) to
295
+ 360 (not included). Best perceived as a degree on a color circle/wheel.
296
+
297
+ Approximate values for common color names:
298
+ - 0 - pink.
299
+ - 30 - red.
300
+ - 60 - orange.
301
+ - 90 - yellow.
302
+ - 135 - green.
303
+ - 180 - cyan.
304
+ - 225 - light blue.
305
+ - 270 - blue.
306
+ - 315 - magenta/purple.
307
+
308
+ - Temperature (`temperature`) - circular distance from current hue to hue 270
309
+ angle (blue). Ranges from 0 (cool) to 180 (hot) anchored at hues 270 (blue)
310
+ and 90 (yellow). Similar to `b` channel but tries to preserve chroma.
311
+
312
+ - Pressure (`pressure`) - circular distance from current hue to hue 180.
313
+ Ranges from 0 (low; green-ish) to 180 (high; red-ish) anchored at hues
314
+ 180 and 0. Similar to `a` channel but tries to preserve chroma.
315
+ Not widely used; added to have something similar to temperature.
316
+
317
+ - a (`a`) - `a` component of Oklab. Describes how "green-red" a color is.
318
+ Can have any value. Negative values are "green-ish", positive - "red-ish".
319
+
320
+ - b (`b`) - `b` component of Oklab. Describes how "blue-yellow" a color is.
321
+ Can have any value. Negative values are "blue-ish", positive - "yellow-ish".
322
+
323
+ - Red (`red`) - `r` component of RGB. Describes how much red a color has.
324
+ Ranges from 0 (no red) to 255 (full red).
325
+
326
+ - Green (`green`) - `g` component of RGB. Describes how much green a color has.
327
+ Ranges from 0 (no green) to 255 (full green).
328
+
329
+ - Blue (`blue`) - `b` component of RGB. Describes how much blue a color has.
330
+ Ranges from 0 (no blue) to 255 (full blue).
331
+
332
+ ------------------------------------------------------------------------------
333
+ *MiniColors-colorscheme*
334
+ Colorscheme object is a central structure of this module. It contains all
335
+ data relevant to colors in fields and provides methods to modify it.
336
+
337
+ Create colorscheme object manually with |MiniColors.as_colorscheme()|: >lua
338
+
339
+ MiniColors.as_colorscheme({
340
+ name = 'my_cs',
341
+ groups = {
342
+ Normal = { fg = '#dddddd', bg = '#222222' },
343
+ SpellBad = { sp = '#dd2222', undercurl = true },
344
+ },
345
+ terminal = { [0] = '#222222', [1] = '#dd2222' },
346
+ })
347
+ <
348
+ Get any registered color scheme (including currently active) as colorscheme
349
+ object with |MiniColors.get_colorscheme()|: >lua
350
+
351
+ -- Get current color scheme
352
+ MiniColors.get_colorscheme()
353
+
354
+ -- Get registered color scheme by name
355
+ MiniColors.get_colorscheme('minischeme', { new_name = 'maxischeme' })
356
+ <
357
+ Class ~
358
+ {Colorscheme}
359
+
360
+ *MiniColors-colorscheme-fields*
361
+
362
+ Fields ~
363
+ {name} `(string|nil)` Name of the color scheme (as in |g:colors_name|).
364
+
365
+ {groups} `(table|nil)` Table with highlight groups data. Keys are group
366
+ names appropriate for `name` argument of |nvim_set_hl()|, values - tables
367
+ appropriate for its `val` argument. Note: gui colors are accepted only in
368
+ short form (`fg`, `bg`, `sp`).
369
+
370
+ {terminal} `(table|nil)` Table with terminal colors data (|terminal-config|).
371
+ Keys are numbers from 0 to 15, values - strings representing color (hex
372
+ string or plain color name; see |nvim_get_color_by_name()|).
373
+
374
+ # Methods ~
375
+ *MiniColors-colorscheme-methods*
376
+
377
+ Notes about all methods:
378
+ - They never modify underlying colorscheme object instead returning deep
379
+ copy with modified fields.
380
+ - They accept `self` colorscheme object as first argument meaning they should be
381
+ called with `:` notation (like `cs:method()`).
382
+
383
+ Example calling methods: >lua
384
+
385
+ -- Get current color scheme, set hue of colors to 135, infer cterm
386
+ -- attributes and apply
387
+ local cs = MiniColors.get_colorscheme()
388
+ cs:chan_set('hue', 135):add_cterm_attributes():apply()
389
+ <
390
+ ## add_cterm_attributes() ~
391
+ *MiniColors-colorscheme:add_cterm_attributes()*
392
+
393
+ Infer |cterm-colors| based on present |gui-colors|. It updates `ctermbg`/`ctermfg`
394
+ based on `fg`/`bg` by approximating in perceptually uniform distance in Oklab
395
+ space (|MiniColors-color-spaces|).
396
+
397
+ ### Parameters ~
398
+ {opts} `(table|nil)` Options. Possible fields:
399
+ - <force> `(boolean)` - Whether to replace already present cterm attributes
400
+ with inferred ones. Default: `true`.
401
+
402
+ ## add_terminal_colors() ~
403
+ *MiniColors-colorscheme:add_terminal_colors()*
404
+
405
+ Infer terminal colors (|terminal-config|) based on colorscheme palette
406
+ (see |MiniColors-colorscheme:get_palette()|). It updates `terminal` field
407
+ based on color scheme's palette by picking the most appropriate entry to
408
+ represent terminal color. Colors from 0 to 7 are attempted to be black,
409
+ red, green, yellow, blue, magenta, cyan, white. Colors from 8 to 15 are
410
+ the same as from 0 to 7.
411
+
412
+ ### Parameters ~
413
+ {opts} `(table|nil)` Options. Possible fields:
414
+ - <force> `(boolean)` - Whether to replace already present terminal colors
415
+ with inferred ones. Default: `true`.
416
+ - <palette_args> `(table)` - |MiniColors-colorscheme:get_palette()| arguments.
417
+
418
+ ## add_transparency() ~
419
+ *MiniColors-colorscheme:add_transparency()*
420
+
421
+ Add transparency by removing background from a certain highlight groups.
422
+ Requires actual transparency from terminal emulator to see background image.
423
+ Has no effect on linked groups; use |MiniColors-colorscheme:resolve_links()|
424
+ explicitly before applying transparency.
425
+
426
+ ### Parameters ~
427
+ {opts} `(table|nil)` Options. Possible fields can be used to configure which
428
+ sets of highlight groups to update:
429
+ - <general> `(boolean)` - general groups (like `Normal`). Default: `true`.
430
+ - <float> `(boolean)` - built-in groups for floating windows. Default: `false`.
431
+ - <statuscolumn> `(boolean)` - groups related to |'statuscolumn'| (signcolumn,
432
+ numbercolumn, foldcolumn, `DiagnosticSignXxx`, and `XxxMsg` groups). Also
433
+ updates groups for all currently defined signs. Default: `false`.
434
+ - <statusline> `(boolean)` - built-in groups for |'statusline'|. Default: `false`.
435
+ - <tabline> `(boolean)` - built-in groups for |'tabline'|. Default: `false`.
436
+ - <winbar> `(boolean)` - built-in groups for |'winbar'|. Default: `false`.
437
+
438
+ ## apply() ~
439
+ *MiniColors-colorscheme:apply()*
440
+
441
+ Apply colorscheme:
442
+ - Set |g:colors_name| to a `name` field.
443
+ - Apply highlight groups in a `groups` field.
444
+ - Set terminal colors from a `terminal` field.
445
+
446
+ ### Parameters ~
447
+ {opts} `(table|nil)` Options. Possible fields:
448
+ - <clear> `(boolean)` - whether to execute |:hi-clear| first. Default: `true`.
449
+
450
+ ## chan_add() ~
451
+ *MiniColors-colorscheme:chan_add()*
452
+
453
+ Add value to a channel (see |MiniColors-channels|).
454
+
455
+ ### Parameters ~
456
+ {channel} `(string)` One of supported |MiniColors-channels|.
457
+ {value} `(number)` Number to add (can be negative).
458
+ {opts} `(table|nil)` Options. Possible fields:
459
+ - <filter> `(function|string)` - filter colors to update. Possible values:
460
+ - String representing target attributes. One of `'fg'`, `'bg'`, `'sp'`,
461
+ `'term'` (only terminal colors).
462
+ - Callable with signature as in |MiniColors-colorscheme:color_modify()|.
463
+ Default: `nil` to update all colors.
464
+ - <gamut_clip> `(string)` - gamut clipping method. One of `'chroma'`,
465
+ `'lightness'`, `'cusp'`. See |MiniColors-gamut-clip|. Default: `'chroma'`.
466
+
467
+
468
+ ## chan_invert() ~
469
+ *MiniColors-colorscheme:chan_invert()*
470
+
471
+ Invert value in a channel (see |MiniColors-channels|).
472
+
473
+ Notes:
474
+ - Most Oklab/Oklch inversions are not exactly invertible: applying it twice
475
+ might lead to slightly different colors depending on gamut clip method
476
+ (|MiniColors-gamut-clip|) like smaller chroma with default `'chroma'` method.
477
+
478
+ ### Parameters ~
479
+ {channel} `(string)` One of supported |MiniColors-channels|.
480
+ {opts} `(table|nil)` Options. Possible fields:
481
+ - <filter> `(function|string)` - filter colors to update. Possible values:
482
+ - String representing target attributes. One of `'fg'`, `'bg'`, `'sp'`,
483
+ `'term'` (only terminal colors).
484
+ - Callable with signature as in |MiniColors-colorscheme:color_modify()|.
485
+ Default: `nil` to update all colors.
486
+ - <gamut_clip> `(string)` - gamut clipping method. One of `'chroma'`,
487
+ `'lightness'`, `'cusp'`. See |MiniColors-gamut-clip|. Default: `'chroma'`.
488
+
489
+ ## chan_modify() ~
490
+ *MiniColors-colorscheme:chan_modify()*
491
+
492
+ Modify channel with a callable.
493
+
494
+ ### Parameters ~
495
+ {channel} `(string)` One of supported |MiniColors-channels|.
496
+ {f} `(function)` - callable which defines modification. Should take current
497
+ value of a channel and return a new one.
498
+ {opts} `(table|nil)` Options. Possible fields:
499
+ - <filter> `(function|string)` - filter colors to update. Possible values:
500
+ - String representing target attributes. One of `'fg'`, `'bg'`, `'sp'`,
501
+ `'term'` (only terminal colors).
502
+ - Callable with signature as in |MiniColors-colorscheme:color_modify()|.
503
+ Default: `nil` to update all colors.
504
+ - <gamut_clip> `(string)` - gamut clipping method. One of `'chroma'`,
505
+ `'lightness'`, `'cusp'`. See |MiniColors-gamut-clip|. Default: `'chroma'`.
506
+
507
+ ## chan_multiply() ~
508
+ *MiniColors-colorscheme:chan_multiply()*
509
+
510
+ Multiply value of a channel (see |MiniColors-channels|).
511
+
512
+ ### Parameters ~
513
+ {channel} `(string)` One of supported |MiniColors-channels|.
514
+ {coef} `(number)` Number to multiply with (can be negative).
515
+ {opts} `(table|nil)` Options. Possible fields:
516
+ - <filter> `(function|string)` - filter colors to update. Possible values:
517
+ - String representing target attributes. One of `'fg'`, `'bg'`, `'sp'`,
518
+ `'term'` (only terminal colors).
519
+ - Callable with signature as in |MiniColors-colorscheme:color_modify()|.
520
+ Default: `nil` to update all colors.
521
+ - <gamut_clip> `(string)` - gamut clipping method. One of `'chroma'`,
522
+ `'lightness'`, `'cusp'`. See |MiniColors-gamut-clip|. Default: `'chroma'`.
523
+
524
+ ## chan_repel() ~
525
+ *MiniColors-colorscheme:chan_repel()*
526
+
527
+ Repel from certain sources.
528
+
529
+ Given an array of repel centers (`sources`) and repel degree (`coef`) add to
530
+ current channel value some amount ("nudge") with the following properties:
531
+ - Nudges from several sources are added together.
532
+ - Nudge is directly proportional to `coef`: bigger `coef` means bigger nudge.
533
+ - Nudge is inversely proportional to the distance between current value and
534
+ source: for positive `coef` bigger distance means smaller nudge, i.e.
535
+ repel effect weakens with distance.
536
+ - With positive `coef` nudges close to source are computed in a way to remove
537
+ whole `[source - coef; source + coef]` range.
538
+ - Negative `coef` results into attraction to source. Nudges in
539
+ `[source - coef; source + coef]` range are computed to completely collapse it
540
+ into `source`.
541
+
542
+ Examples: >lua
543
+
544
+ -- Repel hue from red color removing hue in range from 20 to 40
545
+ chan_repel('hue', 30, 10)
546
+
547
+ -- Attract hue to red color collapsing [20; 40] range into 30.
548
+ chan_repel('hue', 30, -10)
549
+ <
550
+ ### Parameters ~
551
+ {channel} `(string)` One of supported |MiniColors-channels|.
552
+ {sources} `(table|number)` Single or multiple source from which to repel.
553
+ {coef} `(number)` Repel degree (can be negative to attract).
554
+ {opts} `(table|nil)` Options. Possible fields:
555
+ - <filter> `(function|string)` - filter colors to update. Possible values:
556
+ - String representing target attributes. One of `'fg'`, `'bg'`, `'sp'`,
557
+ `'term'` (only terminal colors).
558
+ - Callable with signature as in |MiniColors-colorscheme:color_modify()|.
559
+ Default: `nil` to update all colors.
560
+ - <gamut_clip> `(string)` - gamut clipping method. One of `'chroma'`,
561
+ `'lightness'`, `'cusp'`. See |MiniColors-gamut-clip|. Default: `'chroma'`.
562
+
563
+ ## chan_set() ~
564
+ *MiniColors-colorscheme:chan_set()*
565
+
566
+ Set channel to certain value(s). This can be used to ensure that channel has
567
+ value(s) only within supplied set. If more than one is supplied, closest
568
+ element to current value is used.
569
+
570
+ ### Parameters ~
571
+ {channel} `(string)` One of supported |MiniColors-channels|.
572
+ {values} `(table|number)` Single or multiple values to set.
573
+ {opts} `(table|nil)` Options. Possible fields:
574
+ - <filter> `(function|string)` - filter colors to update. Possible values:
575
+ - String representing target attributes. One of `'fg'`, `'bg'`, `'sp'`,
576
+ `'term'` (only terminal colors).
577
+ - Callable with signature as in |MiniColors-colorscheme:color_modify()|.
578
+ Default: `nil` to update all colors.
579
+ - <gamut_clip> `(string)` - gamut clipping method. One of `'chroma'`,
580
+ `'lightness'`, `'cusp'`. See |MiniColors-gamut-clip|. Default: `'chroma'`.
581
+
582
+ ## color_modify() ~
583
+ *MiniColors-colorscheme:color_modify()*
584
+
585
+ Modify all colors with a callable. It should return new color value (hex
586
+ string or `nil` to remove attribute) base on the following input:
587
+ - Current color as hex string.
588
+ - Data about the color: a table with fields:
589
+ - <attr> - one of `'fg'`, `'bg'`, `'sp'`, and `'term'` for terminal color.
590
+ - <name> - name of color source. Either a name of highlight group or
591
+ string of the form `terminal_color_x` for terminal color (as in
592
+ |terminal-config|).
593
+
594
+ Example: >lua
595
+
596
+ -- Set to '#dd2222' all foreground colors for groups starting with "N"
597
+ color_modify(function(hex, data)
598
+ if data.attr == 'fg' and data.name:find('^N') then
599
+ return '#dd2222'
600
+ end
601
+ return hex
602
+ end)
603
+ <
604
+ ### Parameters ~
605
+ {f} `(function)` Callable returning new color value.
606
+
607
+ ## compress() ~
608
+ *MiniColors-colorscheme:compress()*
609
+
610
+ Remove redundant highlight groups. These are one of the two kinds:
611
+ - Having values identical to ones after |:hi-clear| (meaning they usually
612
+ don't add new information).
613
+ - Coming from a curated list of plugins with highlight groups usually not
614
+ worth keeping around. Current list of such plugins:
615
+ - [nvim-tree/nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons)
616
+ - [norcalli/nvim-colorizer.lua](https://github.com/norcalli/nvim-colorizer.lua)
617
+
618
+ This method is useful to reduce size of color scheme before writing into
619
+ the file with |MiniColors-colorscheme:write()|.
620
+
621
+ ### Parameters ~
622
+ {opts} `(table|nil)` Options. Possible fields:
623
+ - <plugins> `(boolean)` - whether to remove highlight groups from a curated
624
+ list of plugins. Default: `true`.
625
+
626
+ ## get_palette() ~
627
+ *MiniColors-colorscheme:get_palette()*
628
+
629
+ Get commonly used colors. This basically counts number of all color
630
+ occurrences and filter out rare ones.
631
+
632
+ It is usually a good idea to apply both |MiniColors-colorscheme:compress()|
633
+ and |MiniColors-colorscheme:resolve_links()| before applying this.
634
+
635
+ ### Parameters ~
636
+ {opts} `(table|nil)` Options. Possible fields:
637
+ - <threshold> `(number)` - relative threshold for groups to keep. A group
638
+ is not included in output if it has less than this many occurrences
639
+ relative to a total number of colors. Default: 0.01.
640
+
641
+ ## resolve_links() ~
642
+ *MiniColors-colorscheme:resolve_links()*
643
+
644
+ Resolve links (|:highlight-link|). This makes all highlight groups with `link`
645
+ attribute have data from a linked one.
646
+
647
+ Notes:
648
+ - Resolves nested links.
649
+ - If some group is linked to a group missing in current colorscheme object,
650
+ it is not resolved.
651
+
652
+ ## simulate_cvd() ~
653
+ *MiniColors-colorscheme:simulate_cvd()*
654
+
655
+ Simulate color vision deficiency (CVD, color blindness). This is basically
656
+ a wrapper using |MiniColors.simulate_cvd()| as a part of
657
+ call to |MiniColors-colorscheme:color_modify()| method.
658
+
659
+ ### Parameters ~
660
+ {cvd_type} `(string)` One of `'protan'`, `'deutan'`, `'tritan'`, `'mono'`.
661
+ {severity} `(number|nil)` Severity of CVD, number between 0 and 1. Default: 1.
662
+
663
+ ## write() ~
664
+ *MiniColors-colorscheme:write()*
665
+
666
+ Write color scheme to a file. It will be a Lua script readily usable as
667
+ a regular color scheme. Useful to both save results of color scheme tweaking
668
+ and making local snapshot of some other color scheme.
669
+
670
+ Sourcing this file on startup usually leads to a better performance that
671
+ sourcing initial color scheme, as it is essentially a conditioned
672
+ |:hi-clear| call followed by a series of |nvim_set_hl()| calls.
673
+
674
+ Default writing location is a "colors" directory of your Neovim config
675
+ directory (see |base-directories|). After writing, it should be available
676
+ for sourcing with |:colorscheme| or |:Colorscheme|.
677
+
678
+ Name of the file by default is taken from `name` field (`'mini_colors'` is
679
+ used if it is `nil`). If color scheme with this name already exists, it
680
+ appends prefix based on current time to make it unique.
681
+
682
+ Notes:
683
+ - If colors were updated, it is usually a good idea to infer cterm attributes
684
+ with |MiniColors-colorscheme:add_cterm_attributes()| prior to writing.
685
+
686
+ ### Parameters ~
687
+ {opts} `(table|nil)` Options. Possible fields:
688
+ - <compress> `(boolean)` - whether to call |MiniColors-colorscheme:compress()|
689
+ prior to writing. Default: `true`.
690
+ - <name> `(string|nil)` - basename of written file. Default: `nil` to infer
691
+ from `name` field.
692
+ - <directory> `(string)` - directory to where file should be saved.
693
+ Default: "colors" subdirectory of Neovim home config (`stdpath("config")`).
694
+
695
+ ------------------------------------------------------------------------------
696
+ *MiniColors.setup()*
697
+ `MiniColors.setup`({config})
698
+ Module setup
699
+
700
+ # :Colorscheme ~
701
+ *:Colorscheme*
702
+
703
+ Calling this function creates a `:Colorscheme` user command. It takes one or
704
+ more registered color scheme names and performs animated transition between
705
+ them (starting from currently active color scheme).
706
+ It uses |MiniColors.animate()| with default options.
707
+
708
+ Parameters ~
709
+ {config} `(table|nil)` Module config table. See |MiniColors.config|.
710
+
711
+ Usage ~
712
+ >lua
713
+ require('mini.colors').setup() -- use default config
714
+ -- OR
715
+ require('mini.colors').setup({}) -- replace {} with your config table
716
+ <
717
+ ------------------------------------------------------------------------------
718
+ *MiniColors.config*
719
+ `MiniColors.config`
720
+ Defaults ~
721
+ >lua
722
+ MiniColors.config = {}
723
+ <
724
+ ------------------------------------------------------------------------------
725
+ *MiniColors.as_colorscheme()*
726
+ `MiniColors.as_colorscheme`({x})
727
+ Create colorscheme object
728
+
729
+ Parameters ~
730
+ {x} `(table)` Table to be transformed into |MiniColors-colorscheme| object.
731
+
732
+ Return ~
733
+ `(table)` Copy of `x` transformed into a colorscheme object.
734
+
735
+ ------------------------------------------------------------------------------
736
+ *MiniColors.get_colorscheme()*
737
+ `MiniColors.get_colorscheme`({name}, {opts})
738
+ Get colorscheme object from registered color scheme
739
+
740
+ Parameters ~
741
+ {name} `(string|nil)` Name of color scheme to use. If `nil` (default) creates
742
+ colorscheme object based on currently active data (|g:colors_name|,
743
+ highlight groups, terminal colors). If string, converts color scheme with
744
+ that name to a colorscheme object.
745
+ {opts} `(table|nil)` Options. Possible fields:
746
+ - <new_name> `(string|nil)` - new name of colorscheme object.
747
+
748
+ Return ~
749
+ `(table)` Colorscheme object (|MiniColors-colorscheme|).
750
+
751
+ ------------------------------------------------------------------------------
752
+ *MiniColors.interactive()*
753
+ `MiniColors.interactive`({opts})
754
+ Start interactive experiments
755
+
756
+ Create a special buffer in which user can write plain Lua code to tweak
757
+ color scheme and apply to get visual feedback.
758
+
759
+ # General principles ~
760
+ - Initial colorscheme object is fixed to interactive buffer on its creation.
761
+
762
+ - There are special buffer convenience mappings:
763
+ - Apply (source) current buffer content.
764
+ - Reset color scheme (make initial colorscheme the current one).
765
+ - Write to a file the result of applying current buffer content.
766
+ This sources current content and calls |MiniColors-colorscheme:write()|.
767
+ - Quit interactive buffer.
768
+
769
+ - User is expected to iteratively tweak color scheme by writing general Lua
770
+ code in interactive buffer and applying it using convenience mapping.
771
+
772
+ - Application of interactive buffer is essentially these steps:
773
+ - Expose `self` as initial colorscheme object on any application.
774
+ It is always the same for every application.
775
+ - Expose initial colorscheme methods as standalone functions. So instead
776
+ of writing `self = self:add_transparency()` user can only write
777
+ `add_transparency()`.
778
+ - Source buffer content as plain Lua code.
779
+
780
+ Example of interactive buffer content: >lua
781
+
782
+ chan_modify('hue', function() return math.random(0, 359) end)
783
+ simulate_cvd('protan')
784
+ add_cterm_attributes()
785
+ add_terminal_colors()
786
+ <
787
+ Parameters ~
788
+ {opts} `(table|nil)` Options. Possible fields:
789
+ - <colorscheme> `(table|nil)` - |MiniColors-colorscheme| object to be
790
+ used as initial colorscheme for executed code. By default uses current
791
+ color scheme.
792
+ - <mappings> `table` - buffer mappings for actions. Possible fields:
793
+ - <Apply> `(string)` - apply buffer code. Default: `'<M-a>'`.
794
+ - <Reset> `(string)` - apply initial color scheme as is. Default: `'<M-r>'`.
795
+ - <Quit> `(string)` - close interactive buffer. Default: `'<M-q>'`.
796
+ - <Write> `(string)` - write result of buffer code into a file.
797
+ Prompts for file name with |vim.ui.input()| and then
798
+ uses |MiniColors-colorscheme:write()| with other options being default.
799
+ Default: `'<M-w>'`.
800
+
801
+ ------------------------------------------------------------------------------
802
+ *MiniColors.animate()*
803
+ `MiniColors.animate`({cs_array}, {opts})
804
+ Animate color scheme change
805
+
806
+ Start from currently active color scheme and loop through `cs_array`.
807
+
808
+ Powers |:Colorscheme| user command created in |MiniColors.setup()|.
809
+
810
+ Parameters ~
811
+ {cs_array} `(table)` Array of |MiniColors-colorscheme| objects.
812
+ {opts} `(table|nil)` Options. Possible fields:
813
+ - <transition_steps> `(number)` - number of intermediate steps to show
814
+ during transition between two color schemes. Bigger values result in
815
+ smoother visual feedback but require more computational power.
816
+ Default: 25.
817
+ - <transition_duration> `(number)` - number of milliseconds to spend
818
+ showing transition. Default: 1000.
819
+ - <show_duration> `(number)` - number of milliseconds to show intermediate
820
+ color schemes (all but last in `cs_array`). Default: 1000.
821
+
822
+ ------------------------------------------------------------------------------
823
+ *MiniColors.convert()*
824
+ `MiniColors.convert`({x}, {to_space}, {opts})
825
+ Convert between color spaces
826
+
827
+ For a list of supported colors spaces see |MiniColors-color-spaces|.
828
+
829
+ Parameters ~
830
+ {x} `(table|string|number|nil)` Color to convert from. Its color space is
831
+ inferred automatically.
832
+ {to_space} `(string)` Id of allowed color space.
833
+ {opts} `(table|nil)` Options. Possible fields:
834
+ - <adjust_lightness> `(boolean)` - whether to adjust lightness value to have
835
+ a more uniform progression from 0 to 100. Set `false` for results more
836
+ compatible with some other Oklab/Oklch implementations (like in CSS).
837
+ Source: "Intermission - a new lightness estimate for Oklab" section of
838
+ https://bottosson.github.io/posts/colorpicker
839
+ Default: `true`.
840
+ - <gamut_clip> `(string)` - method for |MiniColors-gamut-clip|.
841
+ Default: `'chroma'`.
842
+
843
+ Return ~
844
+ `(table|string|number|nil)` Color in space `to_space` or `nil` if input is `nil`.
845
+
846
+ ------------------------------------------------------------------------------
847
+ *MiniColors.modify_channel()*
848
+ `MiniColors.modify_channel`({x}, {channel}, {f}, {opts})
849
+ Modify channel
850
+
851
+ Parameters ~
852
+ {x} `(table|string|number|nil)` Color which channel will be modified. Color
853
+ space is inferred automatically.
854
+ {channel} `(string)` One of supported |MiniColors-channels|.
855
+ {f} `(function)` Callable which defines modification. Should take current
856
+ value of a channel and return a new one.
857
+ {opts} `(table|nil)` Options. Possible fields:
858
+ - <gamut_clip> `(string)` - method for |MiniColors-gamut-clip|.
859
+ Default: `'chroma'`.
860
+
861
+ Return ~
862
+ `(string|nil)` Hex string of color with modified channel or `nil` if input is `nil`.
863
+
864
+ ------------------------------------------------------------------------------
865
+ *MiniColors.simulate_cvd()*
866
+ `MiniColors.simulate_cvd`({x}, {cvd_type}, {severity})
867
+ Simulate color vision deficiency
868
+
869
+ Parameters ~
870
+ {x} `(table|string|number|nil)` Color to convert from. Its color space is
871
+ inferred automatically.
872
+ {cvd_type} `(string)` Type of CVD. One of `'protan'`, `'deutan'`,
873
+ or `'mono'` (equivalent to converting to graysacle).
874
+ {severity} `(number|nil)` Severity of CVD. A number between 0 and 1 (default).
875
+
876
+ Return ~
877
+ `(string|nil)` Hex string of simulated color or `nil` if input is `nil`.
878
+
879
+
880
+ vim:tw=78:ts=8:noet:ft=help:norl: