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,2088 @@
1
+ --- *mini.hues* Generate configurable color scheme
2
+ ---
3
+ --- MIT License Copyright (c) 2023 Evgeni Chasnovski
4
+
5
+ --- Features:
6
+ --- - Required to set two base colors: background and foreground.
7
+ --- Their shades and other non-base colors are computed to be as much
8
+ --- perceptually different as reasonably possible.
9
+ --- See |MiniHues.config| for setup inspiration.
10
+ ---
11
+ --- - Configurable:
12
+ --- - Number of hues used for non-base colors (from 0 to 8).
13
+ --- - Saturation level ("low", "lowmedium", "medium", "mediumhigh", "high").
14
+ --- - Accent color used for some selected UI elements.
15
+ --- - Plugin integration (can be selectively enabled for faster startup).
16
+ ---
17
+ --- - Random generator for base colors. See |MiniHues.gen_random_base_colors()|.
18
+ --- Powers |randomhue| color scheme.
19
+ ---
20
+ --- - Lua function to compute palette used in color scheme.
21
+ --- See |MiniHues.make_palette()|.
22
+ ---
23
+ --- - Bundled color schemes. See |MiniHues-color-schemes|.
24
+ ---
25
+ --- Supported highlight groups:
26
+ --- - All built-in UI and syntax groups.
27
+ ---
28
+ --- - Built-in Neovim LSP and diagnostic.
29
+ ---
30
+ --- - Tree-sitter (|treesitter-highlight-groups|).
31
+ ---
32
+ --- - LSP semantic tokens (|lsp-semantic-highlight|).
33
+ ---
34
+ --- - Plugins (either with explicit definition or by verification that default
35
+ --- highlighting works appropriately):
36
+ --- - [nvim-mini/mini.nvim](https://nvim-mini.org/mini.nvim)
37
+ --- - [akinsho/bufferline.nvim](https://github.com/akinsho/bufferline.nvim)
38
+ --- - [anuvyklack/hydra.nvim](https://github.com/anuvyklack/hydra.nvim)
39
+ --- - [DanilaMihailov/beacon.nvim](https://github.com/DanilaMihailov/beacon.nvim)
40
+ --- - [folke/lazy.nvim](https://github.com/folke/lazy.nvim)
41
+ --- - [folke/noice.nvim](https://github.com/folke/noice.nvim)
42
+ --- - [folke/snacks.nvim](https://github.com/folke/snacks.nvim)
43
+ --- - [folke/todo-comments.nvim](https://github.com/folke/todo-comments.nvim)
44
+ --- - [folke/trouble.nvim](https://github.com/folke/trouble.nvim)
45
+ --- - [folke/which-key.nvim](https://github.com/folke/which-key.nvim)
46
+ --- - [ggandor/leap.nvim](https://github.com/ggandor/leap.nvim)
47
+ --- - [glepnir/dashboard-nvim](https://github.com/glepnir/dashboard-nvim)
48
+ --- - [glepnir/lspsaga.nvim](https://github.com/glepnir/lspsaga.nvim)
49
+ --- - [HiPhish/rainbow-delimiters.nvim](https://github.com/HiPhish/rainbow-delimiters.nvim)
50
+ --- - [hrsh7th/nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
51
+ --- - [ibhagwan/fzf-lua](https://github.com/ibhagwan/fzf-lua)
52
+ --- - [justinmk/vim-sneak](https://github.com/justinmk/vim-sneak)
53
+ --- - [kevinhwang91/nvim-bqf](https://github.com/kevinhwang91/nvim-bqf)
54
+ --- - [kevinhwang91/nvim-ufo](https://github.com/kevinhwang91/nvim-ufo)
55
+ --- - [lewis6991/gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)
56
+ --- - [lukas-reineke/indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim)
57
+ --- - [MeanderingProgrammer/render-markdown.nvim](https://github.com/MeanderingProgrammer/render-markdown.nvim)
58
+ --- - [neoclide/coc.nvim](https://github.com/neoclide/coc.nvim)
59
+ --- - [NeogitOrg/neogit](https://github.com/NeogitOrg/neogit)
60
+ --- - [nvim-lualine/lualine.nvim](https://github.com/nvim-lualine/lualine.nvim)
61
+ --- - [nvim-neo-tree/neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim)
62
+ --- - [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
63
+ --- - [nvim-tree/nvim-tree.lua](https://github.com/nvim-tree/nvim-tree.lua)
64
+ --- - [OXY2DEV/helpview.nvim](https://github.com/OXY2DEV/helpview.nvim)
65
+ --- - [OXY2DEV/markview.nvim](https://github.com/OXY2DEV/markview.nvim)
66
+ --- - [phaazon/hop.nvim](https://github.com/phaazon/hop.nvim)
67
+ --- - [rcarriga/nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui)
68
+ --- - [rcarriga/nvim-notify](https://github.com/rcarriga/nvim-notify)
69
+ --- - [rlane/pounce.nvim](https://github.com/rlane/pounce.nvim)
70
+ --- - [romgrk/barbar.nvim](https://github.com/romgrk/barbar.nvim)
71
+ --- - [saghen/blink.cmp](https://github.com/saghen/blink.cmp)
72
+ --- - [stevearc/aerial.nvim](https://github.com/stevearc/aerial.nvim)
73
+ --- - [williamboman/mason.nvim](https://github.com/williamboman/mason.nvim)
74
+ ---
75
+ --- # Setup ~
76
+ ---
77
+ --- This module needs a setup with `require('mini.hues').setup({})` and
78
+ --- MANDATORY `background` AND `foreground` FIELDS (add more fields to fit
79
+ --- your taste). It will create global Lua table `MiniHues` which you can use
80
+ --- for scripting or manually (with `:lua MiniHues.*`).
81
+ ---
82
+ --- See |MiniHues.config| for `config` structure and default values.
83
+ ---
84
+ --- This module doesn't have runtime options, so using `vim.b.minihues_config`
85
+ --- will have no effect here.
86
+ ---
87
+ --- Example: >lua
88
+ ---
89
+ --- require('mini.hues').setup({
90
+ --- background = '#11262d',
91
+ --- foreground = '#c0c8cc',
92
+ --- plugins = {
93
+ --- default = false,
94
+ --- ['nvim-mini/mini.nvim'] = true,
95
+ --- },
96
+ --- })
97
+ --- <
98
+ --- # Notes ~
99
+ ---
100
+ --- - This is used to create some of plugin's color schemes
101
+ --- (see |MiniHues-color-schemes|).
102
+ ---
103
+ --- - Using `setup()` doesn't actually create a colorscheme. It basically
104
+ --- creates a coordinated set of |highlight-groups|. To create your own scheme:
105
+ --- - Put "myscheme.lua" file (name after your chosen theme name) inside
106
+ --- any "colors" directory reachable from |'runtimepath'| ("colors" inside
107
+ --- your Neovim config directory is usually enough).
108
+ --- - Inside "myscheme.lua" call `require('mini.hues').setup()` with your
109
+ --- palette and only after that set |g:colors_name| to "myscheme".
110
+ ---
111
+ --- - This module doesn't define |cterm-colors| for implementation simplicity.
112
+ --- It only works if |'termguicolors'| is enabled (should be done automatically
113
+ --- if the terminal emulator supporst 24-bit colors). If not possible,
114
+ --- use |MiniColors-colorscheme:add_cterm_attributes()| from |mini.colors|
115
+ --- to define custom color scheme with 16-color support.
116
+ ---@tag MiniHues
117
+
118
+ --- Bundled color schemes
119
+ ---
120
+ --- - *miniwinter* : "icy winter" palette with azure background.
121
+ --- - *minispring* : "blooming spring" palette with green background.
122
+ --- - *minisummer* : "hot summer" palette with brown/yellow background.
123
+ --- - *miniautumn* : "cooling autumn" palette with purple background.
124
+ ---
125
+ --- - *randomhue* : uses randomly generated same hue background and foreground.
126
+ --- Every `:colorscheme randomhue` call results in a different (randomly yet
127
+ --- carefully selected) colors.
128
+ ---
129
+ --- It is essentially a combination of calls to |MiniHues.setup()| and
130
+ --- |MiniHues.gen_random_base_colors()| with slight adjustments for |'background'|.
131
+ ---
132
+ --- Activate it as regular |:colorscheme|. Get currently active config with
133
+ --- `:lua print(vim.inspect(MiniHues.config))`.
134
+ ---@tag MiniHues-color-schemes
135
+
136
+ ---@diagnostic disable:undefined-field
137
+ ---@diagnostic disable:discard-returns
138
+ ---@diagnostic disable:unused-local
139
+
140
+ -- Module definition ==========================================================
141
+ local MiniHues = {}
142
+ local H = {}
143
+
144
+ --- Module setup
145
+ ---
146
+ --- Main side effect is to create palette and apply it. Essentially, a combination
147
+ --- of |MiniHues.make_palette()| and |MiniHues.apply_palette()|.
148
+ ---
149
+ ---@usage >lua
150
+ --- require('mini.hues').setup({
151
+ --- -- Use config table as you like
152
+ --- -- Needs both `background` and `foreground` fields present
153
+ --- background = '#11262d',
154
+ --- foreground = '#c0c8cc',
155
+ --- })
156
+ --- <
157
+ MiniHues.setup = function(config)
158
+ -- TODO: Remove after Neovim=0.9 support is dropped
159
+ if vim.fn.has('nvim-0.10') == 0 then
160
+ vim.notify(
161
+ '(mini.hues) Neovim<0.10 is soft deprecated (module works but is not supported).'
162
+ .. " It will be deprecated after the next 'mini.nvim' release (module might not work)."
163
+ .. ' Please update your Neovim version.'
164
+ )
165
+ end
166
+
167
+ -- Export module
168
+ _G.MiniHues = MiniHues
169
+
170
+ -- Setup config
171
+ config = H.setup_config(config)
172
+
173
+ -- Apply config
174
+ H.apply_config(config)
175
+ end
176
+
177
+ --- Defaults ~
178
+ ---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section)
179
+ ---@text See |MiniHues.make_palette()| for more information about how certain settings
180
+ --- affect output color scheme.
181
+ ---
182
+ --- # Plugin integrations ~
183
+ ---
184
+ --- `config.plugins` defines for which supported plugins highlight groups will
185
+ --- be created. Limiting number of integrations slightly decreases startup time.
186
+ --- It is a table with boolean (`true`/`false`) values which are applied as follows:
187
+ --- - If plugin name (as listed in |mini.hues|) has entry, it is used.
188
+ --- - Otherwise `config.plugins.default` is used.
189
+ ---
190
+ --- Example which will load only "mini.nvim" integration: >lua
191
+ ---
192
+ --- require('mini.hues').setup({
193
+ --- background = '#11262d',
194
+ --- foreground = '#c0c8cc',
195
+ --- plugins = {
196
+ --- default = false,
197
+ --- ['nvim-mini/mini.nvim'] = true,
198
+ --- },
199
+ --- })
200
+ --- <
201
+ --- # Auto adjust ~
202
+ ---
203
+ --- `config.autoadjust` defines whether to adjust some highlight groups based on
204
+ --- events relevant to them. Currently adjusted groups:
205
+ ---
206
+ --- - |hl-MsgSeparator| is adjusted based on `msgsep` flag in |'fillchars'|.
207
+ --- If it is whitespace - highlight background, otherwise - foreground.
208
+ ---
209
+ --- - |hl-Pmenu| is adjusted based on |'pumborder'| value (on Neovim>=0.12).
210
+ --- If it results in a border - same as floating window (but with no accent
211
+ --- foreground in border), otherwise - same as |hl-CursorLine|. This design
212
+ --- makes |ins-completion-menu| stand out from regular floating windows.
213
+ ---
214
+ --- # Examples ~
215
+ --- *MiniHues-examples*
216
+ ---
217
+ --- Here are some possible setup configurations (copy first line and then use
218
+ --- only one `setup` call): >lua
219
+ ---
220
+ --- local setup = require('mini.hues').setup
221
+ ---
222
+ --- -- Choose background and foreground
223
+ --- setup({ background = '#2f1c22', foreground = '#cdc4c6' }) -- red
224
+ --- setup({ background = '#2f1e16', foreground = '#cdc5c1' }) -- orange
225
+ --- setup({ background = '#282211', foreground = '#c9c6c0' }) -- yellow
226
+ --- setup({ background = '#1c2617', foreground = '#c4c8c2' }) -- green
227
+ --- setup({ background = '#112723', foreground = '#c0c9c7' }) -- cyan
228
+ --- setup({ background = '#11262d', foreground = '#c0c8cc' }) -- azure
229
+ --- setup({ background = '#1d2231', foreground = '#c4c6cd' }) -- blue
230
+ --- setup({ background = '#281e2c', foreground = '#c9c5cb' }) -- purple
231
+ ---
232
+ --- -- Choose number of accent colors
233
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', n_hues = 6 })
234
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', n_hues = 4 })
235
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', n_hues = 2 })
236
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', n_hues = 0 })
237
+ ---
238
+ --- -- Choose saturation of colored text
239
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', saturation = 'low' })
240
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', saturation = 'lowmedium' })
241
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', saturation = 'medium' })
242
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', saturation = 'mediumhigh' })
243
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', saturation = 'high' })
244
+ ---
245
+ --- -- Choose accent color
246
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', accent = 'bg' })
247
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', accent = 'red' })
248
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', accent = 'yellow' })
249
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', accent = 'cyan' })
250
+ --- setup({ background = '#11262d', foreground = '#c0c8cc', accent = 'blue' })
251
+ --- <
252
+ MiniHues.config = {
253
+ -- REQUIRED base colors as '#rrggbb' hex strings
254
+ background = nil,
255
+ foreground = nil,
256
+
257
+ -- Number of hues used for non-base colors
258
+ n_hues = 8,
259
+
260
+ -- Saturation. One of 'low', 'lowmedium', 'medium', 'mediumhigh', 'high'.
261
+ saturation = 'medium',
262
+
263
+ -- Accent color. One of: 'bg', 'fg', 'red', 'orange', 'yellow', 'green',
264
+ -- 'cyan', 'azure', 'blue', 'purple'
265
+ accent = 'bg',
266
+
267
+ -- Plugin integrations. Use `default = false` to disable all integrations.
268
+ -- Also can be set per plugin (see |MiniHues.config|).
269
+ plugins = { default = true },
270
+
271
+ -- Whether to auto adjust highlight groups based on certain events
272
+ autoadjust = true,
273
+ }
274
+ --minidoc_afterlines_end
275
+
276
+ --- # Make palette ~
277
+ ---
278
+ --- General idea of palette generation is that it is mostly based on color channel
279
+ --- information extracted from base colors (background and foreground).
280
+ ---
281
+ --- All operations are done inside `Oklch` color space, meaning that each color
282
+ --- is defined by three numbers:
283
+ --- - Lightness (`l`) - number between 0 (black) and 100 (white) describing how
284
+ --- light is a color.
285
+ --- - Chroma (`c`) - positive number describing how colorful is a color (bigger
286
+ --- values - more colorful; 0 is gray).
287
+ --- - Hue (`h`) - periodic number in [0, 360) describing a value of "true color"
288
+ --- on color circle/wheel.
289
+ ---
290
+ --- For more details about `Oklch` see |MiniColors-color-spaces| or
291
+ --- https://bottosson.github.io/posts/oklab/.
292
+ ---
293
+ --- ## Algorithm overview ~
294
+ ---
295
+ --- - Extract lightness, chroma, and hue of base colors.
296
+ ---
297
+ --- - Generate reference lightness values:
298
+ --- - Background edge: 0 or 100, whichever is closest to background lightness.
299
+ --- - Foreground edge: 0 or 100, different from background edge.
300
+ --- - Middle: arithmetic mean of background and foreground lightness values.
301
+ ---
302
+ --- - Compute background and foreground tints and shades by changing lightness
303
+ --- of background color: two colors closer to background lightness edge and
304
+ --- two closer to middle.
305
+ ---
306
+ --- - Pick chroma value for non-base colors based on `config.saturation`.
307
+ ---
308
+ --- - Generate hues for non-base colors:
309
+ --- - Fit an equidistant circular grid with `config.n_hues` points to be as
310
+ --- far from both background and foreground hues. This will ensure that
311
+ --- non-base colors are as different as possible from base ones (for
312
+ --- better visual perception).
313
+ --- Example: for background hue 0, foreground hue 180, and `config.n_hues` 2
314
+ --- the output grid will be `{ 90, 270 }`.
315
+ ---
316
+ --- - For each hue of reference color (which itself is an equidistant grid
317
+ --- of 8 hues) compute the closest value from the grid. This allows
318
+ --- operating in same terms (like "red", "green") despite maybe actually
319
+ --- having less different hues.
320
+ ---
321
+ --- - Compute for each hue two variants of non-base colors: with background and
322
+ --- foreground lightness values.
323
+ ---
324
+ --- - Compute two variants of accent color (with background and foreground
325
+ --- lightness) based on `config.accent`.
326
+ ---
327
+ --- Notes:
328
+ --- - Some output colors can have not exact values of generated Oklch channels.
329
+ --- This is due to actually computed colors being impossible to represent via
330
+ --- `'#rrggbb'` hex string. In this case a process called gamut clipping is done
331
+ --- to reduce lightness and chroma in optimal way while maintaining same hue.
332
+ --- For more information see |MiniColors-gamut-clip|.
333
+ ---
334
+ --- - Not all colors are actually used in highlight groups and are present for the
335
+ --- sake of completeness.
336
+ ---
337
+ ---@param config table Configuration for palette. Same structure as |MiniHues.config|.
338
+ --- Needs to have <background> and <foreground> fields.
339
+ ---
340
+ ---@return table Palette with the following fields:
341
+ --- - <bg> and <fg> with supplied `background` and `foreground` colors.
342
+ --- - Fields like <bg_xxx> and <fg_xxx> are essentially <bg> and <fg> but with
343
+ --- different lightness values: `_edge`/`_edge2` - closer to edge lightness,
344
+ --- `_mid`/`_mid2` - closer to middle lightness.
345
+ --- - Fields for non-base colors (<red>, <orange>, <yellow>, <green>, <cyan>,
346
+ --- <azure>, <blue>, <purple>) have the same lightness as foreground.
347
+ --- - Fields for non-base colors with <_bg> suffix have the same lightness as
348
+ --- background.
349
+ --- - <accent> and <accent_bg> represent accent colors with foreground and
350
+ --- background lightness values.
351
+ ---
352
+ ---@seealso |MiniHues.get_palette()|
353
+ MiniHues.make_palette = function(config)
354
+ config = vim.tbl_deep_extend('force', MiniHues.config, config or {})
355
+ local bg = H.validate_hex(config.background, 'background')
356
+ local fg = H.validate_hex(config.foreground, 'foreground')
357
+ local n_hues = H.validate_n_hues(config.n_hues)
358
+ local saturation = H.validate_one_of(config.saturation, H.saturation_values, 'saturation')
359
+ local accent = H.validate_one_of(config.accent, H.accent_values, 'accent')
360
+
361
+ local bg_lch, fg_lch = H.hex2oklch(bg), H.hex2oklch(fg)
362
+ local bg_l, fg_l = bg_lch.l, fg_lch.l
363
+ if not ((bg_l <= 50 and 50 < fg_l) or (fg_l <= 50 and 50 < bg_l)) then
364
+ H.error('`background` and `foreground` should have opposite lightness.')
365
+ end
366
+
367
+ -- Reference lightness levels
368
+ local is_dark = bg_l <= 50
369
+ local l_bg_edge = is_dark and 0 or 100
370
+ local l_fg_edge = is_dark and 100 or 0
371
+ local l_mid = 0.5 * (bg_l + fg_l)
372
+
373
+ -- Configurable chroma level
374
+ local chroma = ({ low = 4, lowmedium = 6, medium = 8, mediumhigh = 12, high = 16 })[saturation]
375
+
376
+ -- Hues
377
+ local hues = H.make_hues(bg_lch.h, fg_lch.h, n_hues)
378
+
379
+ -- Compute result
380
+ --stylua: ignore
381
+ local res = {
382
+ -- `_edge`/`_mid` are third of the way towards reference (edge/middle)
383
+ -- `_edge2`/`_mid2` are two thirds
384
+ bg_edge2 = H.oklch2hex({ l = 0.33 * bg_l + 0.67 * l_bg_edge, c = bg_lch.c, h = bg_lch.h }),
385
+ bg_edge = H.oklch2hex({ l = 0.67 * bg_l + 0.33 * l_bg_edge, c = bg_lch.c, h = bg_lch.h }),
386
+ bg = bg,
387
+ bg_mid = H.oklch2hex({ l = 0.67 * bg_l + 0.33 * l_mid, c = bg_lch.c, h = bg_lch.h }),
388
+ bg_mid2 = H.oklch2hex({ l = 0.33 * bg_l + 0.67 * l_mid, c = bg_lch.c, h = bg_lch.h }),
389
+
390
+ fg_edge2 = H.oklch2hex({ l = 0.33 * fg_l + 0.67 * l_fg_edge, c = fg_lch.c, h = fg_lch.h }),
391
+ fg_edge = H.oklch2hex({ l = 0.67 * fg_l + 0.33 * l_fg_edge, c = fg_lch.c, h = fg_lch.h }),
392
+ fg = fg,
393
+ fg_mid = H.oklch2hex({ l = 0.67 * fg_l + 0.33 * l_mid, c = fg_lch.c, h = fg_lch.h }),
394
+ fg_mid2 = H.oklch2hex({ l = 0.33 * fg_l + 0.67 * l_mid, c = fg_lch.c, h = fg_lch.h }),
395
+
396
+ red = H.oklch2hex({ l = fg_l, c = chroma, h = hues.red }),
397
+ red_bg = H.oklch2hex({ l = bg_l, c = chroma, h = hues.red }),
398
+
399
+ orange = H.oklch2hex({ l = fg_l, c = chroma, h = hues.orange }),
400
+ orange_bg = H.oklch2hex({ l = bg_l, c = chroma, h = hues.orange }),
401
+
402
+ yellow = H.oklch2hex({ l = fg_l, c = chroma, h = hues.yellow }),
403
+ yellow_bg = H.oklch2hex({ l = bg_l, c = chroma, h = hues.yellow }),
404
+
405
+ green = H.oklch2hex({ l = fg_l, c = chroma, h = hues.green }),
406
+ green_bg = H.oklch2hex({ l = bg_l, c = chroma, h = hues.green }),
407
+
408
+ cyan = H.oklch2hex({ l = fg_l, c = chroma, h = hues.cyan }),
409
+ cyan_bg = H.oklch2hex({ l = bg_l, c = chroma, h = hues.cyan }),
410
+
411
+ azure = H.oklch2hex({ l = fg_l, c = chroma, h = hues.azure }),
412
+ azure_bg = H.oklch2hex({ l = bg_l, c = chroma, h = hues.azure }),
413
+
414
+ blue = H.oklch2hex({ l = fg_l, c = chroma, h = hues.blue }),
415
+ blue_bg = H.oklch2hex({ l = bg_l, c = chroma, h = hues.blue }),
416
+
417
+ purple = H.oklch2hex({ l = fg_l, c = chroma, h = hues.purple }),
418
+ purple_bg = H.oklch2hex({ l = bg_l, c = chroma, h = hues.purple }),
419
+ }
420
+
421
+ -- Manage 'bg' and 'fg' accents separately to ensure that corresponding
422
+ -- background and foreground colors match exactly
423
+ --stylua: ignore
424
+ if accent == 'bg' then
425
+ res.accent = H.oklch2hex({ l = fg_l, c = chroma, h = bg_lch.h })
426
+ res.accent_bg = bg
427
+ elseif accent == 'fg' then
428
+ res.accent = fg
429
+ res.accent_bg = H.oklch2hex({ l = bg_l, c = chroma, h = fg_lch.h })
430
+ else
431
+ res.accent = H.oklch2hex({ l = fg_l, c = chroma, h = hues[accent] })
432
+ res.accent_bg = H.oklch2hex({ l = bg_l, c = chroma, h = hues[accent] })
433
+ end
434
+
435
+ return res
436
+ end
437
+
438
+ -- stylua: ignore
439
+ --- Apply palette
440
+ ---
441
+ --- Create color scheme highlight groups and terminal colors based on supplied
442
+ --- palette. This is useful if you want to tweak palette colors.
443
+ --- For regular usage prefer |MiniHues.setup()|.
444
+ ---
445
+ ---@param palette table Table with structure as |MiniHues.make_palette()| output.
446
+ ---@param plugins table|nil Table with boolean values indicating whether to create
447
+ --- highlight groups for specific plugins. See |MiniHues.config| for more details.
448
+ --- Default: the value from |MiniHues.config|.
449
+ ---@param opts table|nil Options. Possible fields:
450
+ --- - <autoadjust> - whether to auto adjust some highlight groups when needed.
451
+ --- Default: value of `autoadjust` in |MiniHues.config|.
452
+ ---
453
+ ---@usage >lua
454
+ --- local palette = require('mini.hues').make_palette({
455
+ --- background = '#11262d',
456
+ --- foreground = '#c0c8cc',
457
+ --- })
458
+ --- palette.cyan = '#76e0a6'
459
+ --- palette.cyan_bg = '#004629'
460
+ --- require('mini.hues').apply_palette(palette)
461
+ --- <
462
+ ---@seealso |MiniHues.get_palette()|
463
+ MiniHues.apply_palette = function(palette, plugins, opts)
464
+ if type(palette) ~= 'table' then H.error('`palette` should be table with palette colors.') end
465
+ plugins = plugins or MiniHues.config.plugins
466
+ if type(plugins) ~= 'table' then H.error('`plugins` should be table with plugin integrations data.') end
467
+ opts = vim.tbl_extend('force', { autoadjust = MiniHues.config.autoadjust }, opts or {})
468
+
469
+ H.palette = vim.deepcopy(palette)
470
+
471
+ -- Prepare highlighting application. Notes:
472
+ -- - Clear current highlight only if other theme was loaded previously.
473
+ -- - No need to `syntax reset` because *all* syntax groups are defined later.
474
+ if vim.g.colors_name then vim.cmd('highlight clear') end
475
+
476
+ -- As this doesn't create colorscheme, don't store any name. Not doing it
477
+ -- might cause some issues with `syntax on`.
478
+ vim.g.colors_name = nil
479
+
480
+ local p, autoadjust = palette, opts.autoadjust
481
+ local hi = function(name, data) vim.api.nvim_set_hl(0, name, data) end
482
+ local has_integration = function(name)
483
+ local entry = plugins[name]
484
+ if entry == nil then return plugins.default end
485
+ return entry
486
+ end
487
+
488
+ -- Special autoadjustable highlight groups
489
+ if autoadjust then H.setup_autoadjust(p) end
490
+
491
+ -- NOTE: recommendations for adding new highlight groups:
492
+ -- - Put all related groups (like for new plugin) in single paragraph.
493
+ -- - Sort within group alphabetically (by hl-group name) ignoring case.
494
+ -- - Link all repeated groups within paragraph (lowers execution time).
495
+ -- - Align by commas.
496
+
497
+ -- Builtin highlighting groups
498
+ hi('ColorColumn', { fg=nil, bg=p.bg_mid2 })
499
+ hi('ComplMatchIns', { fg=nil, bg=nil })
500
+ hi('Conceal', { fg=p.azure, bg=nil })
501
+ hi('CurSearch', { fg=p.bg, bg=p.yellow })
502
+ hi('Cursor', { fg=p.bg, bg=p.fg })
503
+ hi('CursorColumn', { fg=nil, bg=p.bg_mid })
504
+ hi('CursorIM', { link='Cursor' })
505
+ hi('CursorLine', { fg=nil, bg=p.bg_mid })
506
+ hi('CursorLineFold', { fg=p.bg_mid2, bg=nil })
507
+ hi('CursorLineNr', { fg=p.accent, bg=nil, bold=true })
508
+ hi('CursorLineSign', { fg=p.bg_mid2, bg=nil })
509
+ hi('DiffAdd', { fg=nil, bg=p.green_bg })
510
+ hi('DiffChange', { fg=nil, bg=p.cyan_bg })
511
+ hi('DiffDelete', { fg=nil, bg=p.red_bg })
512
+ hi('DiffText', { fg=nil, bg=p.yellow_bg })
513
+ hi('DiffTextAdd', { link='DiffAdd' })
514
+ hi('Directory', { fg=p.azure, bg=nil })
515
+ hi('EndOfBuffer', { fg=p.bg_mid2, bg=nil })
516
+ hi('ErrorMsg', { fg=p.red, bg=nil })
517
+ hi('FloatBorder', { fg=p.accent, bg=p.bg_edge })
518
+ hi('FloatTitle', { fg=p.accent, bg=p.bg_edge, bold=true })
519
+ hi('FoldColumn', { fg=p.bg_mid2, bg=nil })
520
+ hi('Folded', { fg=p.fg_mid2, bg=p.bg_edge })
521
+ hi('IncSearch', { fg=p.bg, bg=p.yellow })
522
+ hi('lCursor', { fg=p.bg, bg=p.fg })
523
+ hi('LineNr', { fg=p.bg_mid2, bg=nil })
524
+ hi('LineNrAbove', { link='LineNr' })
525
+ hi('LineNrBelow', { link='LineNr' })
526
+ hi('MatchParen', { fg=nil, bg=p.bg_mid2, bold=true })
527
+ hi('ModeMsg', { fg=p.green, bg=nil })
528
+ hi('MoreMsg', { fg=p.azure, bg=nil })
529
+ hi('MsgArea', { link='Normal' })
530
+ hi('MsgSeparator', H.attr_msgseparator(p, autoadjust))
531
+ hi('NonText', { fg=p.bg_mid2, bg=nil })
532
+ hi('Normal', { fg=p.fg, bg=p.bg })
533
+ hi('NormalFloat', { fg=p.fg, bg=p.bg_edge })
534
+ hi('NormalNC', { link='Normal' })
535
+ hi('OkMsg', { fg=p.green, bg=nil })
536
+ hi('Pmenu', H.attr_pmenu(p, autoadjust))
537
+ hi('PmenuBorder', { link='Pmenu' })
538
+ hi('PmenuExtra', { link='Pmenu' })
539
+ hi('PmenuExtraSel', { link='PmenuSel' })
540
+ hi('PmenuKind', { link='Pmenu' })
541
+ hi('PmenuKindSel', { link='PmenuSel' })
542
+ hi('PmenuMatch', { fg=nil, bg=nil, bold=true })
543
+ hi('PmenuMatchSel', { fg=nil, bg=nil, bold=true, blend=0, reverse=true })
544
+ hi('PmenuSbar', { link='Pmenu' })
545
+ hi('PmenuSel', { fg=nil, bg=nil, blend=0, reverse=true })
546
+ hi('PmenuThumb', { fg=nil, bg=p.bg_mid2 })
547
+ hi('Question', { fg=p.azure, bg=nil })
548
+ hi('QuickFixLine', { fg=nil, bg=nil, bold=true })
549
+ hi('Search', { fg=p.bg, bg=p.accent })
550
+ hi('SignColumn', { fg=p.bg_mid2, bg=nil })
551
+ hi('SpecialKey', { fg=p.accent, bg=nil })
552
+ hi('SpellBad', { fg=nil, bg=nil, sp=p.red, undercurl=true })
553
+ hi('SpellCap', { fg=nil, bg=nil, sp=p.cyan, undercurl=true })
554
+ hi('SpellLocal', { fg=nil, bg=nil, sp=p.yellow, undercurl=true })
555
+ hi('SpellRare', { fg=nil, bg=nil, sp=p.blue, undercurl=true })
556
+ hi('StatusLine', { fg=p.fg_mid, bg=p.accent_bg })
557
+ hi('StatusLineNC', { fg=p.fg_mid, bg=p.bg_edge })
558
+ hi('StderrMsg', { link='ErrorMsg' })
559
+ hi('StdoutMsg', { link='MsgArea' })
560
+ hi('Substitute', { fg=p.bg, bg=p.blue })
561
+ hi('TabLine', { fg=p.fg_mid, bg=p.bg_edge })
562
+ hi('TabLineFill', { link='Tabline' })
563
+ hi('TabLineSel', { fg=p.accent, bg=p.bg_edge })
564
+ hi('TermCursor', { fg=nil, bg=nil, reverse=true })
565
+ hi('TermCursorNC', { fg=nil, bg=nil, reverse=true })
566
+ hi('Title', { fg=p.accent, bg=nil })
567
+ hi('VertSplit', { fg=p.accent, bg=nil })
568
+ hi('Visual', { fg=nil, bg=p.bg_mid2 })
569
+ hi('VisualNOS', { fg=nil, bg=p.bg_mid })
570
+ hi('WarningMsg', { fg=p.yellow, bg=nil })
571
+ hi('Whitespace', { fg=p.bg_mid2, bg=nil })
572
+ hi('WildMenu', { link='PmenuSel' })
573
+ hi('WinBar', { link='StatusLine' })
574
+ hi('WinBarNC', { link='StatusLineNC' })
575
+ hi('WinSeparator', { fg=p.accent, bg=nil })
576
+
577
+ -- Standard syntax (affects treesitter)
578
+ hi('Boolean', { link='Constant' })
579
+ hi('Character', { link='Constant' })
580
+ hi('Comment', { fg=p.fg_mid2, bg=nil })
581
+ hi('Conditional', { link='Statement' })
582
+ hi('Constant', { fg=p.purple, bg=nil })
583
+ hi('Debug', { link='Special' })
584
+ hi('Define', { link='PreProc' })
585
+ hi('Delimiter', { fg=p.orange, bg=nil })
586
+ hi('Error', { fg=nil, bg=p.red_bg })
587
+ hi('Exception', { link='Statement' })
588
+ hi('Float', { link='Constant' })
589
+ hi('Function', { fg=p.azure, bg=nil })
590
+ hi('Identifier', { fg=p.yellow, bg=nil })
591
+ hi('Ignore', { fg=nil, bg=nil })
592
+ hi('Include', { link='PreProc' })
593
+ hi('Keyword', { link='Statement' })
594
+ hi('Label', { link='Statement' })
595
+ hi('Macro', { link='PreProc' })
596
+ hi('Number', { link='Constant' })
597
+ hi('Operator', { fg=p.fg, bg=nil })
598
+ hi('PreCondit', { link='PreProc' })
599
+ hi('PreProc', { fg=p.blue, bg=nil })
600
+ hi('Repeat', { link='Statement' })
601
+ hi('Special', { fg=p.cyan, bg=nil })
602
+ hi('SpecialChar', { link='Special' })
603
+ hi('SpecialComment', { link='Special' })
604
+ hi('Statement', { fg=p.fg, bg=nil, bold=true })
605
+ hi('StorageClass', { link='Type' })
606
+ hi('String', { fg=p.green, bg=nil })
607
+ hi('Structure', { link='Type' })
608
+ hi('Tag', { link='Special' })
609
+ hi('Todo', { fg=p.accent, bg=p.accent_bg, bold=true })
610
+ hi('Type', { fg=p.fg, bg=nil })
611
+ hi('Typedef', { link='Type' })
612
+
613
+ -- Other community standard
614
+ hi('Bold', { fg=nil, bg=nil, bold=true })
615
+ hi('Italic', { fg=nil, bg=nil, italic=true })
616
+ hi('Underlined', { fg=nil, bg=nil, underline=true })
617
+
618
+ -- Patch diff
619
+ hi('diffAdded', { fg=p.green, bg=nil })
620
+ hi('diffChanged', { fg=p.cyan, bg=nil })
621
+ hi('diffFile', { fg=p.yellow, bg=nil })
622
+ hi('diffLine', { fg=p.blue, bg=nil })
623
+ hi('diffRemoved', { fg=p.red, bg=nil })
624
+ hi('Added', { fg=p.green, bg=nil })
625
+ hi('Changed', { fg=p.cyan, bg=nil })
626
+ hi('Removed', { fg=p.red, bg=nil })
627
+
628
+ -- Git commit
629
+ hi('gitcommitBranch', { fg=p.orange, bg=nil, bold=true })
630
+ hi('gitcommitComment', { link='Comment' })
631
+ hi('gitcommitDiscarded', { link='Comment' })
632
+ hi('gitcommitDiscardedFile', { fg=p.yellow, bg=nil, bold=true })
633
+ hi('gitcommitDiscardedType', { fg=p.azure, bg=nil })
634
+ hi('gitcommitHeader', { link='Title' })
635
+ hi('gitcommitOverflow', { fg=p.yellow, bg=nil })
636
+ hi('gitcommitSelected', { link='Comment' })
637
+ hi('gitcommitSelectedFile', { fg=p.green, bg=nil, bold=true })
638
+ hi('gitcommitSelectedType', { link='gitcommitDiscardedType' })
639
+ hi('gitcommitSummary', { fg=p.green, bg=nil })
640
+ hi('gitcommitUnmergedFile', { link='gitcommitDiscardedFile' })
641
+ hi('gitcommitUnmergedType', { link='gitcommitDiscardedType' })
642
+ hi('gitcommitUntracked', { link='Comment' })
643
+ hi('gitcommitUntrackedFile', { fg=p.cyan, bg=nil })
644
+
645
+ -- Built-in diagnostic
646
+ -- Logic:
647
+ -- - Error is red.
648
+ -- - Distance from hue to error hue should increase the less important it is
649
+ -- (warning - info - ok - hint).
650
+ hi('DiagnosticError', { fg=p.red, bg=nil })
651
+ hi('DiagnosticHint', { fg=p.cyan, bg=nil })
652
+ hi('DiagnosticInfo', { fg=p.blue, bg=nil })
653
+ hi('DiagnosticOk', { fg=p.green, bg=nil })
654
+ hi('DiagnosticWarn', { fg=p.yellow, bg=nil })
655
+
656
+ hi('DiagnosticUnderlineError', { fg=nil, bg=nil, sp=p.red, underline=true })
657
+ hi('DiagnosticUnderlineHint', { fg=nil, bg=nil, sp=p.cyan, underline=true })
658
+ hi('DiagnosticUnderlineInfo', { fg=nil, bg=nil, sp=p.blue, underline=true })
659
+ hi('DiagnosticUnderlineOk', { fg=nil, bg=nil, sp=p.green, underline=true })
660
+ hi('DiagnosticUnderlineWarn', { fg=nil, bg=nil, sp=p.yellow, underline=true })
661
+
662
+ hi('DiagnosticFloatingError', { fg=p.red, bg=p.bg_edge })
663
+ hi('DiagnosticFloatingHint', { fg=p.cyan, bg=p.bg_edge })
664
+ hi('DiagnosticFloatingInfo', { fg=p.blue, bg=p.bg_edge })
665
+ hi('DiagnosticFloatingOk', { fg=p.green, bg=p.bg_edge })
666
+ hi('DiagnosticFloatingWarn', { fg=p.yellow, bg=p.bg_edge })
667
+
668
+ hi('DiagnosticVirtualTextError', { link='DiagnosticError' })
669
+ hi('DiagnosticVirtualTextWarn', { link='DiagnosticWarn' })
670
+ hi('DiagnosticVirtualTextInfo', { link='DiagnosticInfo' })
671
+ hi('DiagnosticVirtualTextHint', { link='DiagnosticHint' })
672
+ hi('DiagnosticVirtualTextOk', { link='DiagnosticOk' })
673
+
674
+ hi('DiagnosticSignError', { link='DiagnosticError' })
675
+ hi('DiagnosticSignWarn', { link='DiagnosticWarn' })
676
+ hi('DiagnosticSignInfo', { link='DiagnosticInfo' })
677
+ hi('DiagnosticSignHint', { link='DiagnosticHint' })
678
+ hi('DiagnosticSignOk', { link='DiagnosticOk' })
679
+
680
+ hi('DiagnosticDeprecated', { fg=nil, bg=nil, sp=p.red, strikethrough=true })
681
+ hi('DiagnosticUnnecessary', { link='Comment' })
682
+
683
+ -- Built-in LSP
684
+ hi('LspReferenceText', { fg=nil, bg=p.bg_mid2 })
685
+ hi('LspReferenceRead', { link='LspReferenceText' })
686
+ hi('LspReferenceWrite', { link='LspReferenceText' })
687
+
688
+ hi('LspSignatureActiveParameter', { link='LspReferenceText' })
689
+
690
+ hi('LspCodeLens', { link='Comment' })
691
+ hi('LspCodeLensSeparator', { link='Comment' })
692
+
693
+ -- Built-in snippets
694
+ hi('SnippetTabstop', { fg=nil, bg=p.yellow_bg })
695
+ hi('SnippetTabstopActive', { fg=nil, bg=p.green_bg })
696
+
697
+ -- Built-in markdown syntax
698
+ hi('markdownH1', { link='@markup.heading.1' })
699
+ hi('markdownH2', { link='@markup.heading.2' })
700
+ hi('markdownH3', { link='@markup.heading.3' })
701
+ hi('markdownH4', { link='@markup.heading.4' })
702
+ hi('markdownH5', { link='@markup.heading.5' })
703
+ hi('markdownH6', { link='@markup.heading.6' })
704
+
705
+ -- Tree-sitter
706
+ -- Sources:
707
+ -- - `:h treesitter-highlight-groups`
708
+ -- - https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#highlights
709
+ hi('@text.literal', { link='Special' })
710
+ hi('@text.reference', { link='Identifier' })
711
+ hi('@text.title', { link='Title' })
712
+ hi('@text.uri', { link='Underlined' })
713
+ hi('@text.todo', { link='Todo' })
714
+ hi('@text.note', { link='MoreMsg' })
715
+ hi('@text.warning', { link='WarningMsg' })
716
+ hi('@text.danger', { link='ErrorMsg' })
717
+ hi('@text.strong', { fg=nil, bg=nil, bold=true })
718
+ hi('@text.emphasis', { fg=nil, bg=nil, italic=true })
719
+ hi('@text.strike', { fg=nil, bg=nil, strikethrough=true })
720
+ hi('@text.underline', { link='Underlined' })
721
+
722
+ hi('@comment', { link='Comment' })
723
+ hi('@punctuation', { link='Delimiter' })
724
+
725
+ hi('@constant', { link='Constant' })
726
+ hi('@constant.builtin', { link='Special' })
727
+ hi('@constant.macro', { link='Macro' })
728
+ hi('@define', { link='Define' })
729
+ hi('@macro', { link='Macro' })
730
+ hi('@string', { link='String' })
731
+ hi('@string.escape', { link='SpecialChar' })
732
+ hi('@string.special', { link='SpecialChar' })
733
+ hi('@character', { link='Character' })
734
+ hi('@character.special', { link='SpecialChar' })
735
+ hi('@number', { link='Number' })
736
+ hi('@boolean', { link='Boolean' })
737
+ hi('@float', { link='Float' })
738
+
739
+ hi('@function', { link='Function' })
740
+ hi('@function.builtin', { link='Special' })
741
+ hi('@function.call', { link='Function' })
742
+ hi('@function.macro', { link='Macro' })
743
+ hi('@parameter', { fg=p.blue, bg=nil })
744
+ hi('@method', { link='Function' })
745
+ hi('@method.call', { link='Function' })
746
+ hi('@field', { link='Identifier' })
747
+ hi('@property', { link='Identifier' })
748
+ hi('@constructor', { link='Special' })
749
+
750
+ hi('@conditional', { link='Conditional' })
751
+ hi('@repeat', { link='Repeat' })
752
+ hi('@label', { link='Label' })
753
+ hi('@operator', { link='Operator' })
754
+ hi('@keyword', { link='Keyword' })
755
+ hi('@keyword.return', { fg=p.orange, bg=nil, bold=true })
756
+ hi('@exception', { link='Exception' })
757
+
758
+ hi('@variable', { fg=p.fg, bg=nil })
759
+ hi('@variable.builtin', { link='Special' })
760
+ hi('@type', { link='Type' })
761
+ hi('@type.builtin', { link='Special' })
762
+ hi('@type.definition', { link='Typedef' })
763
+ hi('@storageclass', { link='StorageClass' })
764
+ hi('@structure', { link='Structure' })
765
+ hi('@namespace', { link='Identifier' })
766
+ hi('@include', { link='Include' })
767
+ hi('@preproc', { link='PreProc' })
768
+ hi('@debug', { link='Debug' })
769
+ hi('@tag', { link='Tag' })
770
+
771
+ hi('@symbol', { link='Keyword' })
772
+ hi('@none', {})
773
+
774
+ -- Semantic tokens. Source: `:h lsp-semantic-highlight`.
775
+ hi('@lsp.type.class', { link='@structure' })
776
+ hi('@lsp.type.decorator', { link='@function' })
777
+ hi('@lsp.type.enum', { link='@type' })
778
+ hi('@lsp.type.enumMember', { link='@constant' })
779
+ hi('@lsp.type.function', { link='@function' })
780
+ hi('@lsp.type.interface', { link='@type' })
781
+ hi('@lsp.type.macro', { link='@macro' })
782
+ hi('@lsp.type.method', { link='@method' })
783
+ hi('@lsp.type.namespace', { link='@namespace' })
784
+ hi('@lsp.type.parameter', { link='@parameter' })
785
+ hi('@lsp.type.property', { link='@property' })
786
+ hi('@lsp.type.struct', { link='@structure' })
787
+ hi('@lsp.type.type', { link='@type' })
788
+ hi('@lsp.type.typeParameter', { link='@type.definition' })
789
+ hi('@lsp.type.variable', { link='@variable' })
790
+
791
+ hi('@lsp.mod.deprecated', { fg=p.red, bg=nil })
792
+
793
+ -- New tree-sitter groups
794
+ if vim.fn.has('nvim-0.10') == 1 then
795
+ -- Sources:
796
+ -- - `:h treesitter-highlight-groups`
797
+ -- - https://github.com/nvim-treesitter/nvim-treesitter/commit/1ae9b0e4558fe7868f8cda2db65239cfb14836d0
798
+ -- NOTE: commented groups are the same as in Neovim<0.10 defined earlier
799
+
800
+ -- @variable
801
+ -- @variable.builtin
802
+ hi('@variable.parameter', { link='@parameter' })
803
+ hi('@variable.member', { link='@field' })
804
+
805
+ -- @constant
806
+ -- @constant.builtin
807
+ -- @constant.macro
808
+
809
+ hi('@module', { link='@namespace' })
810
+ hi('@module.builtin', { link='@variable.builtin' })
811
+ -- @label
812
+
813
+ -- @string
814
+ hi('@string.documentation', { link='@string' })
815
+ hi('@string.regexp', { link='SpecialChar' })
816
+ -- @string.escape
817
+ -- @string.special
818
+ hi('@string.special.symbol', { link='@constant' })
819
+ hi('@string.special.path', { link='Directory' })
820
+ hi('@string.special.url', { link='@markup.link.url' })
821
+ hi('@string.special.vimdoc', { link='@constant' })
822
+
823
+ -- @character
824
+ -- @character.special
825
+
826
+ -- @boolean
827
+ -- @number
828
+ hi('@number.float', { link='@float' })
829
+
830
+ -- @type
831
+ -- @type.builtin
832
+ -- @type.definition
833
+ hi('@type.qualifier', { link='StorageClass' })
834
+
835
+ hi('@attribute', { link='Macro' })
836
+ -- @property
837
+
838
+ -- @function
839
+ -- @function.builtin
840
+ -- @function.call
841
+ -- @function.macro
842
+
843
+ hi('@function.method', { link='@method' })
844
+ hi('@function.method.call', { link='@method.call' })
845
+
846
+ -- @constructor
847
+ -- @operator
848
+
849
+ -- @keyword
850
+ hi('@keyword.coroutine', { link='@keyword' })
851
+ hi('@keyword.function', { link='@keyword' })
852
+ hi('@keyword.operator', { link='@keyword' })
853
+ hi('@keyword.import', { fg=p.blue, bg=nil, bold=true })
854
+ hi('@keyword.storage', { fg=p.fg, bg=nil, bold=true })
855
+ hi('@keyword.repeat', { link='@keyword' })
856
+ -- @keyword.return
857
+ hi('@keyword.debug', { fg=p.cyan, bg=nil, bold=true })
858
+ hi('@keyword.exception', { link='@keyword' })
859
+
860
+ hi('@keyword.conditional', { link='@keyword' })
861
+ hi('@keyword.conditional.ternary', { link='keyword' })
862
+
863
+ hi('@keyword.directive', { fg=p.blue, bg=nil, bold=true })
864
+ hi('@keyword.directive.define', { link='@keyword.directive' })
865
+
866
+ hi('@punctuation.delimiter', { link='@punctuation' })
867
+ hi('@punctuation.bracket', { link='@punctuation' })
868
+ hi('@punctuation.special', { link='Special' })
869
+
870
+ -- @comment
871
+ hi('@comment.documentation', { link='@comment' })
872
+
873
+ hi('@comment.error', { link='@text.danger' })
874
+ hi('@comment.warning', { link='@text.warning' })
875
+ hi('@comment.todo', { link='@text.todo' })
876
+ hi('@comment.note', { link='@text.note' })
877
+
878
+ hi('@markup.strong', { link='@text.strong' })
879
+ hi('@markup.italic', { link='@text.emphasis' })
880
+ hi('@markup.strikethrough', { link='@text.strike' })
881
+ hi('@markup.underline', { link='@text.underline' })
882
+
883
+ hi('@markup.heading', { link='@text.title' })
884
+ hi('@markup.heading.1', { fg=p.orange, bg=nil })
885
+ hi('@markup.heading.2', { fg=p.yellow, bg=nil })
886
+ hi('@markup.heading.3', { fg=p.green, bg=nil })
887
+ hi('@markup.heading.4', { fg=p.cyan, bg=nil })
888
+ hi('@markup.heading.5', { fg=p.azure, bg=nil })
889
+ hi('@markup.heading.6', { fg=p.blue, bg=nil })
890
+
891
+ hi('@markup.heading.1.delimiter.vimdoc', { fg=p.bg_mid2, bg=nil, bold=true })
892
+ hi('@markup.heading.2.delimiter.vimdoc', { fg=p.bg_mid2, bg=nil, bold=true })
893
+ hi('@markup.heading.4.vimdoc', { link='Title' })
894
+
895
+ hi('@markup.quote', { link='@string.special' })
896
+ hi('@markup.math', { link='@string.special' })
897
+ hi('@markup.environment', { link='@module' })
898
+
899
+ hi('@markup.link', { link='@text.reference' })
900
+ hi('@markup.link.label', { link='@markup.link' })
901
+ hi('@markup.link.url', { fg=p.fg, bg=nil, underline=true })
902
+
903
+ hi('@markup.raw', { link='@text.literal' })
904
+ hi('@markup.raw.block', { link='@markup.raw' })
905
+
906
+ hi('@markup.list', { link='@punctuation.special' })
907
+ hi('@markup.list.checked', { link='DiagnosticOk' })
908
+ hi('@markup.list.unchecked', { link='DiagnosticWarn' })
909
+
910
+ hi('@diff.plus', { link='diffAdded' })
911
+ hi('@diff.minus', { link='diffRemoved' })
912
+ hi('@diff.delta', { link='diffChanged' })
913
+
914
+ -- @tag
915
+ hi('@tag.attribute', { link='@tag' })
916
+ hi('@tag.delimiter', { link='@punctuation' })
917
+ end
918
+
919
+ -- Plugins
920
+ -- nvim-mini/mini.nvim
921
+ -- TODO: Remove 'echasnovski/mini.nvim' fallback after September 2026
922
+ if has_integration('nvim-mini/mini.nvim') or has_integration('echasnovski/mini.nvim') then
923
+ hi('MiniAnimateCursor', { fg=nil, bg=nil, reverse=true, nocombine=true })
924
+ hi('MiniAnimateNormalFloat', { link='NormalFloat' })
925
+
926
+ hi('MiniClueBorder', { link='FloatBorder' })
927
+ hi('MiniClueDescGroup', { link='DiagnosticFloatingWarn' })
928
+ hi('MiniClueDescSingle', { link='NormalFloat' })
929
+ hi('MiniClueNextKey', { link='DiagnosticFloatingHint' })
930
+ hi('MiniClueNextKeyWithPostkeys', { link='DiagnosticFloatingError' })
931
+ hi('MiniClueSeparator', { link='DiagnosticFloatingInfo' })
932
+ hi('MiniClueTitle', { link='FloatTitle' })
933
+
934
+ hi('MiniCmdlinePeekBorder', { link='FloatBorder' })
935
+ hi('MiniCmdlinePeekLineNr', { link='DiagnosticSignWarn' })
936
+ hi('MiniCmdlinePeekNormal', { link='NormalFloat' })
937
+ hi('MiniCmdlinePeekSep', { link='SignColumn' })
938
+ hi('MiniCmdlinePeekSign', { link='DiagnosticSignHint' })
939
+ hi('MiniCmdlinePeekTitle', { link='FloatTitle' })
940
+
941
+ hi('MiniCompletionActiveParameter', { link='LspSignatureActiveParameter' })
942
+ hi('MiniCompletionDeprecated', { link='DiagnosticDeprecated' })
943
+ hi('MiniCompletionInfoBorderOutdated', { link='DiagnosticFloatingWarn' })
944
+
945
+ hi('MiniCursorword', { fg=nil, bg=nil, underline=true })
946
+ hi('MiniCursorwordCurrent', { fg=nil, bg=nil, underline=true })
947
+
948
+ hi('MiniDepsChangeAdded', { link='diffAdded' })
949
+ hi('MiniDepsChangeRemoved', { link='diffRemoved' })
950
+ hi('MiniDepsHint', { link='DiagnosticHint' })
951
+ hi('MiniDepsInfo', { link='DiagnosticInfo' })
952
+ hi('MiniDepsMsgBreaking', { link='DiagnosticWarn' })
953
+ hi('MiniDepsPlaceholder', { link='Comment' })
954
+ hi('MiniDepsTitle', { link='Title' })
955
+ hi('MiniDepsTitleError', { link='DiffDelete' })
956
+ hi('MiniDepsTitleSame', { link='DiffText' })
957
+ hi('MiniDepsTitleUpdate', { link='DiffAdd' })
958
+
959
+ hi('MiniDiffSignAdd', { link='diffAdded' })
960
+ hi('MiniDiffSignChange', { link='diffChanged' })
961
+ hi('MiniDiffSignDelete', { link='diffRemoved' })
962
+ hi('MiniDiffOverAdd', { link='DiffAdd' })
963
+ hi('MiniDiffOverChange', { link='DiffText' })
964
+ hi('MiniDiffOverChangeBuf', { link='MiniDiffOverChange' })
965
+ hi('MiniDiffOverContext', { link='DiffChange' })
966
+ hi('MiniDiffOverContextBuf', {})
967
+ hi('MiniDiffOverDelete', { link='DiffDelete' })
968
+
969
+ hi('MiniFilesBorder', { link='FloatBorder' })
970
+ hi('MiniFilesBorderModified', { link='DiagnosticFloatingWarn' })
971
+ hi('MiniFilesCursorLine', { link='CursorLine' })
972
+ hi('MiniFilesDirectory', { link='Directory' })
973
+ hi('MiniFilesFile', { fg=p.fg, bg=nil })
974
+ hi('MiniFilesNormal', { link='NormalFloat' })
975
+ hi('MiniFilesTitle', { link='FloatTitle' })
976
+ hi('MiniFilesTitleFocused', { fg=p.fg, bg=p.bg_edge, bold=true })
977
+
978
+ hi('MiniHipatternsFixme', { fg=p.bg, bg=p.red, bold=true })
979
+ hi('MiniHipatternsHack', { fg=p.bg, bg=p.yellow, bold=true })
980
+ hi('MiniHipatternsNote', { fg=p.bg, bg=p.cyan, bold=true })
981
+ hi('MiniHipatternsTodo', { fg=p.bg, bg=p.blue, bold=true })
982
+
983
+ hi('MiniIconsAzure', { fg=p.azure, bg=nil })
984
+ hi('MiniIconsBlue', { fg=p.blue, bg=nil })
985
+ hi('MiniIconsCyan', { fg=p.cyan, bg=nil })
986
+ hi('MiniIconsGreen', { fg=p.green, bg=nil })
987
+ hi('MiniIconsGrey', { fg=p.fg_edge, bg=nil })
988
+ hi('MiniIconsOrange', { fg=p.orange, bg=nil })
989
+ hi('MiniIconsPurple', { fg=p.purple, bg=nil })
990
+ hi('MiniIconsRed', { fg=p.red, bg=nil })
991
+ hi('MiniIconsYellow', { fg=p.yellow, bg=nil })
992
+
993
+ hi('MiniIndentscopeSymbol', { fg=p.accent, bg=nil })
994
+ hi('MiniIndentscopeSymbolOff', { fg=p.red, bg=nil })
995
+
996
+ hi('MiniInputAdded', { link='DiagnosticFloatingOk' })
997
+ hi('MiniInputBorder', { link='FloatBorder' })
998
+ hi('MiniInputCaret', { link='MiniInputPrompt' })
999
+ hi('MiniInputHide', { link='DiagnosticFloatingWarn' })
1000
+ hi('MiniInputHint', { link='DiagnosticFloatingHint' })
1001
+ hi('MiniInputNormal', { link='NormalFloat' })
1002
+ hi('MiniInputPrompt', { link='DiagnosticFloatingInfo' })
1003
+ hi('MiniInputSpecial', { link='DiagnosticFloatingWarn' })
1004
+
1005
+ hi('MiniJump', { fg=nil, bg=nil, sp=p.accent, undercurl=true })
1006
+
1007
+ hi('MiniJump2dDim', { fg=p.bg_mid2, bg=nil })
1008
+ hi('MiniJump2dSpot', { fg=p.fg_edge2, bg=p.bg_edge2, bold=true, nocombine=true })
1009
+ hi('MiniJump2dSpotAhead', { fg=p.fg_edge, bg=p.bg_edge2, nocombine=true })
1010
+ hi('MiniJump2dSpotUnique', { link='MiniJump2dSpot' })
1011
+
1012
+ hi('MiniMapNormal', { fg=p.fg_mid2, bg=p.bg_edge })
1013
+ hi('MiniMapSymbolCount', { fg=p.fg_mid2, bg=nil })
1014
+ hi('MiniMapSymbolLine', { fg=p.accent, bg=nil })
1015
+ hi('MiniMapSymbolView', { fg=p.accent, bg=nil })
1016
+
1017
+ hi('MiniNotifyBorder', { link='FloatBorder' })
1018
+ hi('MiniNotifyLspProgress', { link='MiniNotifyNormal' })
1019
+ hi('MiniNotifyNormal', { link='NormalFloat' })
1020
+ hi('MiniNotifyTitle', { link='FloatTitle' })
1021
+
1022
+ hi('MiniOperatorsExchangeFrom', { link='IncSearch' })
1023
+
1024
+ hi('MiniPickBorder', { link='FloatBorder' })
1025
+ hi('MiniPickBorderBusy', { link='DiagnosticFloatingWarn' })
1026
+ hi('MiniPickBorderText', { link='FloatTitle' })
1027
+ hi('MiniPickCursor', { blend=100, nocombine=true })
1028
+ hi('MiniPickIconDirectory', { link='Directory' })
1029
+ hi('MiniPickIconFile', { link='MiniPickNormal' })
1030
+ hi('MiniPickHeader', { link='DiagnosticFloatingHint' })
1031
+ hi('MiniPickMatchCurrent', { link='CursorLine' })
1032
+ hi('MiniPickMatchMarked', { link='Visual' })
1033
+ hi('MiniPickMatchRanges', { link='DiagnosticFloatingHint' })
1034
+ hi('MiniPickNormal', { link='NormalFloat' })
1035
+ hi('MiniPickPreviewLine', { link='CursorLine' })
1036
+ hi('MiniPickPreviewRegion', { link='IncSearch' })
1037
+ hi('MiniPickPrompt', { link='MiniPickMatchRanges' })
1038
+ hi('MiniPickPromptCaret', { link='DiagnosticFloatingInfo' })
1039
+ hi('MiniPickPromptPrefix', { link='DiagnosticFloatingInfo' })
1040
+
1041
+ hi('MiniSnippetsCurrent', { fg=nil, bg=nil, sp=p.yellow, underdouble=true })
1042
+ hi('MiniSnippetsCurrentReplace', { fg=nil, bg=nil, sp=p.red, underdouble=true })
1043
+ hi('MiniSnippetsFinal', { fg=nil, bg=nil, sp=p.green, underdouble=true })
1044
+ hi('MiniSnippetsUnvisited', { fg=nil, bg=nil, sp=p.cyan, underdouble=true })
1045
+ hi('MiniSnippetsVisited', { fg=nil, bg=nil, sp=p.blue, underdouble=true })
1046
+
1047
+ hi('MiniStarterCurrent', { link='MiniStarterItem' })
1048
+ hi('MiniStarterFooter', { link='Comment' })
1049
+ hi('MiniStarterHeader', { fg=p.accent, bg=nil, bold=true })
1050
+ hi('MiniStarterInactive', { link='Comment' })
1051
+ hi('MiniStarterItem', { link='Normal' })
1052
+ hi('MiniStarterItemBullet', { fg=p.fg_mid2, bg=nil })
1053
+ hi('MiniStarterItemPrefix', { fg=p.yellow, bg=nil, bold=true })
1054
+ hi('MiniStarterSection', { fg=p.purple, bg=nil })
1055
+ hi('MiniStarterQuery', { fg=p.green, bg=nil, bold=true })
1056
+
1057
+ hi('MiniStatuslineDevinfo', { fg=p.fg_mid, bg=p.bg_mid })
1058
+ hi('MiniStatuslineFileinfo', { link='MiniStatuslineDevinfo' })
1059
+ hi('MiniStatuslineFilename', { fg=p.fg_mid, bg=p.accent_bg })
1060
+ hi('MiniStatuslineInactive', { link='StatusLineNC' })
1061
+ hi('MiniStatuslineModeCommand', { fg=p.bg, bg=p.yellow, bold=true })
1062
+ hi('MiniStatuslineModeInsert', { fg=p.bg, bg=p.azure, bold=true })
1063
+ hi('MiniStatuslineModeNormal', { fg=p.bg, bg=p.fg, bold=true })
1064
+ hi('MiniStatuslineModeOther', { fg=p.bg, bg=p.cyan, bold=true })
1065
+ hi('MiniStatuslineModeReplace', { fg=p.bg, bg=p.red, bold=true })
1066
+ hi('MiniStatuslineModeVisual', { fg=p.bg, bg=p.green, bold=true })
1067
+
1068
+ hi('MiniSurround', { link='IncSearch' })
1069
+
1070
+ hi('MiniTablineCurrent', { fg=p.accent, bg=p.bg, bold=true })
1071
+ hi('MiniTablineFill', { link='MiniTablineHidden' })
1072
+ hi('MiniTablineHidden', { fg=p.fg_mid, bg=p.bg_edge })
1073
+ hi('MiniTablineModifiedCurrent', { fg=p.bg, bg=p.accent, bold=true })
1074
+ hi('MiniTablineModifiedHidden', { fg=p.bg_edge, bg=p.fg_mid })
1075
+ hi('MiniTablineModifiedVisible', { fg=p.bg_edge, bg=p.fg_mid, bold=true })
1076
+ hi('MiniTablineTabpagesection', { fg=p.bg, bg=p.green, bold=true })
1077
+ hi('MiniTablineTrunc', { fg=p.accent, bg=p.bg_edge, bold=true })
1078
+ hi('MiniTablineVisible', { fg=p.fg_mid, bg=p.bg_edge, bold=true })
1079
+
1080
+ hi('MiniTestEmphasis', { fg=nil, bg=nil, bold=true })
1081
+ hi('MiniTestFail', { fg=p.red, bg=nil, bold=true })
1082
+ hi('MiniTestPass', { fg=p.green, bg=nil, bold=true })
1083
+
1084
+ hi('MiniTrailspace', { fg=nil, bg=p.red_bg })
1085
+ end
1086
+
1087
+ if has_integration('akinsho/bufferline.nvim') then
1088
+ hi('BufferLineBuffer', { fg=p.fg_mid2, bg=nil })
1089
+ hi('BufferLineBufferSelected', { fg=p.fg, bg=nil, bold=true })
1090
+ hi('BufferLineBufferVisible', { fg=p.fg, bg=nil })
1091
+ hi('BufferLineCloseButton', { link='BufferLineBackground' })
1092
+ hi('BufferLineCloseButtonSelected', { link='BufferLineBufferSelected' })
1093
+ hi('BufferLineCloseButtonVisible', { link='BufferLineBufferVisible' })
1094
+ hi('BufferLineFill', { link='Normal' })
1095
+ hi('BufferLineTab', { fg=p.bg, bg=p.green })
1096
+ hi('BufferLineTabSelected', { fg=p.bg, bg=p.green, bold=true })
1097
+ end
1098
+
1099
+ if has_integration('anuvyklack/hydra.nvim') then
1100
+ hi('HydraRed', { fg=p.red, bg=nil })
1101
+ hi('HydraBlue', { fg=p.azure, bg=nil })
1102
+ hi('HydraAmaranth', { fg=p.purple, bg=nil })
1103
+ hi('HydraTeal', { fg=p.cyan, bg=nil })
1104
+ hi('HydraPink', { fg=p.orange, bg=nil })
1105
+ hi('HydraHint', { link='NormalFloat' })
1106
+ end
1107
+
1108
+ if has_integration('DanilaMihailov/beacon.nvim') then
1109
+ hi('Beacon', { fg=nil, bg=p.fg_edge2 })
1110
+ end
1111
+
1112
+ if has_integration('folke/lazy.nvim') then
1113
+ hi('LazyButton', { fg=nil, bg=p.bg_mid })
1114
+ hi('LazyButtonActive', { fg=nil, bg=p.bg_mid2 })
1115
+ hi('LazyDimmed', { link='Comment' })
1116
+ hi('LazyH1', { fg=p.accent, bg=p.bg_mid2, bold=true })
1117
+ end
1118
+
1119
+ if has_integration('folke/noice.nvim') then
1120
+ hi('NoiceCmdlinePopupBorder', { fg=p.azure, bg=nil })
1121
+ hi('NoiceConfirmBorder', { fg=p.yellow, bg=nil })
1122
+ end
1123
+
1124
+ if has_integration('folke/snacks.nvim') then
1125
+ hi('SnacksPickerBufFlags', { link='Comment' })
1126
+ hi('SnacksPickerDir', { link='Comment' })
1127
+ hi('SnacksPickerGitStatusIgnored', { link='Comment' })
1128
+ hi('SnacksPickerGitStatusUntracked', { link='Comment' })
1129
+ hi('SnacksPickerKeymapRhs', { link='Comment' })
1130
+ hi('SnacksPickerListCursorLine', { link='CursorLine' })
1131
+ hi('SnacksPickerPathHidden', { link='Comment' })
1132
+ hi('SnacksPickerPathIgnored', { link='Comment' })
1133
+ hi('SnacksPickerTotals', { link='Comment' })
1134
+ hi('SnacksPickerUnselected', { link='Comment' })
1135
+ end
1136
+
1137
+ -- folke/trouble.nvim
1138
+ if has_integration('folke/trouble.nvim') then
1139
+ hi('TroubleCount', { fg=p.accent, bg=nil, bold=true })
1140
+ hi('TroubleFoldIcon', { fg=p.accent, bg=nil, bold=true })
1141
+ hi('TroubleIndent', { fg=p.bg_mid2, bg=nil })
1142
+ hi('TroubleLocation', { fg=p.fg_mid, bg=nil })
1143
+ hi('TroubleSignError', { link='DiagnosticError' })
1144
+ hi('TroubleSignHint', { link='DiagnosticHint' })
1145
+ hi('TroubleSignInformation', { link='DiagnosticInfo' })
1146
+ hi('TroubleSignOther', { link='DiagnosticInfo' })
1147
+ hi('TroubleSignWarning', { link='DiagnosticWarn' })
1148
+ hi('TroubleText', { fg=p.fg, bg=nil })
1149
+ hi('TroubleTextError', { link='TroubleText' })
1150
+ hi('TroubleTextHint', { link='TroubleText' })
1151
+ hi('TroubleTextInformation', { link='TroubleText' })
1152
+ hi('TroubleTextWarning', { link='TroubleText' })
1153
+ end
1154
+
1155
+ -- folke/todo-comments.nvim
1156
+ -- Everything works correctly out of the box
1157
+
1158
+ if has_integration('folke/which-key.nvim') then
1159
+ hi('WhichKey', { fg=p.cyan, bg=nil })
1160
+ hi('WhichKeyBorder', { link='FloatBorder' })
1161
+ hi('WhichKeyDesc', { fg=p.fg, bg=nil })
1162
+ hi('WhichKeyFloat', { fg=p.fg, bg=p.bg_edge })
1163
+ hi('WhichKeyGroup', { fg=p.red, bg=nil })
1164
+ hi('WhichKeySeparator', { fg=p.green, bg=nil })
1165
+ hi('WhichKeyValue', { link='Comment' })
1166
+ end
1167
+
1168
+ if has_integration('ggandor/leap.nvim') then
1169
+ hi('LeapMatch', { fg=p.green, bg=nil, bold=true, nocombine=true, underline=true })
1170
+ hi('LeapLabel', { fg=p.yellow, bg=nil, bold=true, nocombine=true })
1171
+ hi('LeapLabelSelected', { fg=p.cyan, bg=nil, bold=true, nocombine=true })
1172
+ hi('LeapBackdrop', { link='Comment' })
1173
+ end
1174
+
1175
+ if has_integration('glepnir/dashboard-nvim') then
1176
+ hi('DashboardCenter', { link='Delimiter' })
1177
+ hi('DashboardFooter', { link='Comment' })
1178
+ hi('DashboardHeader', { link='Title' })
1179
+ hi('DashboardShortCut', { link='WarningMsg' })
1180
+ end
1181
+
1182
+ if has_integration('glepnir/lspsaga.nvim') then
1183
+ hi('LspSagaCodeActionBorder', { fg=p.accent, bg=nil })
1184
+ hi('LspSagaCodeActionContent', { fg=p.fg, bg=nil })
1185
+ hi('LspSagaCodeActionTitle', { fg=p.azure, bg=nil, bold=true })
1186
+
1187
+ hi('Definitions', { fg=p.green, bg=nil })
1188
+ hi('DefinitionsIcon', { fg=p.azure, bg=nil })
1189
+ hi('FinderParam', { fg=p.yellow, bg=nil })
1190
+ hi('FinderVirtText', { fg=p.orange, bg=nil })
1191
+ hi('LspSagaAutoPreview', { fg=p.blue, bg=nil })
1192
+ hi('LspSagaFinderSelection', { fg=p.cyan, bg=nil })
1193
+ hi('LspSagaLspFinderBorder', { fg=p.accent, bg=nil })
1194
+ hi('References', { fg=p.green, bg=nil })
1195
+ hi('ReferencesIcon', { fg=p.azure, bg=nil })
1196
+ hi('TargetFileName', { fg=p.fg, bg=nil })
1197
+
1198
+ hi('FinderSpinner', { fg=p.green, bg=nil })
1199
+ hi('FinderSpinnerBorder', { fg=p.accent, bg=nil })
1200
+ hi('FinderSpinnerTitle', { link='Title' })
1201
+
1202
+ hi('LspSagaDefPreviewBorder', { fg=p.accent, bg=nil })
1203
+
1204
+ hi('LspSagaHoverBorder', { fg=p.accent, bg=nil })
1205
+
1206
+ hi('LspSagaRenameBorder', { fg=p.accent, bg=nil })
1207
+
1208
+ hi('LspSagaDiagnosticBorder', { fg=p.accent, bg=nil })
1209
+ hi('LspSagaDiagnosticHeader', { link='Title' })
1210
+ hi('LspSagaDiagnosticSource', { fg=p.orange, bg=nil })
1211
+
1212
+ hi('LspSagaBorderTitle', { link='FloatTitle' })
1213
+
1214
+ hi('LspSagaSignatureHelpBorder', { fg=p.accent, bg=nil })
1215
+
1216
+ hi('LSOutlinePreviewBorder', { fg=p.accent, bg=nil })
1217
+ hi('OutlineDetail', { fg=p.bg_mid2, bg=nil })
1218
+ hi('OutlineFoldPrefix', { fg=p.yellow, bg=nil })
1219
+ hi('OutlineIndentEvn', { fg=p.fg_mid2, bg=nil })
1220
+ hi('OutlineIndentOdd', { fg=p.fg, bg=nil })
1221
+ end
1222
+
1223
+ if has_integration('HiPhish/rainbow-delimiters.nvim') then
1224
+ hi('RainbowDelimiterBlue', { fg=p.azure, bg=nil })
1225
+ hi('RainbowDelimiterCyan', { fg=p.cyan, bg=nil })
1226
+ hi('RainbowDelimiterGreen', { fg=p.green, bg=nil })
1227
+ hi('RainbowDelimiterOrange', { fg=p.orange, bg=nil })
1228
+ hi('RainbowDelimiterRed', { fg=p.red, bg=nil })
1229
+ hi('RainbowDelimiterViolet', { fg=p.purple, bg=nil })
1230
+ hi('RainbowDelimiterYellow', { fg=p.yellow, bg=nil })
1231
+ end
1232
+
1233
+ if has_integration('hrsh7th/nvim-cmp') then
1234
+ hi('CmpItemAbbr', { fg=p.fg, bg=nil })
1235
+ hi('CmpItemAbbrDeprecated', { link='Comment' })
1236
+ hi('CmpItemAbbrMatch', { fg=nil, bg=nil, bold=true })
1237
+ hi('CmpItemAbbrMatchFuzzy', { fg=nil, bg=nil, bold=true })
1238
+ hi('CmpItemKind', { fg=p.fg, bg=nil })
1239
+ hi('CmpItemMenu', { fg=p.fg, bg=nil })
1240
+
1241
+ hi('CmpItemKindClass', { link='Type' })
1242
+ hi('CmpItemKindColor', { link='Special' })
1243
+ hi('CmpItemKindConstant', { link='Constant' })
1244
+ hi('CmpItemKindConstructor', { link='Type' })
1245
+ hi('CmpItemKindEnum', { link='Structure' })
1246
+ hi('CmpItemKindEnumMember', { link='Structure' })
1247
+ hi('CmpItemKindEvent', { link='Exception' })
1248
+ hi('CmpItemKindField', { link='Structure' })
1249
+ hi('CmpItemKindFile', { link='Tag' })
1250
+ hi('CmpItemKindFolder', { link='Directory' })
1251
+ hi('CmpItemKindFunction', { link='Function' })
1252
+ hi('CmpItemKindInterface', { link='Structure' })
1253
+ hi('CmpItemKindKeyword', { link='Keyword' })
1254
+ hi('CmpItemKindMethod', { link='Function' })
1255
+ hi('CmpItemKindModule', { link='Structure' })
1256
+ hi('CmpItemKindOperator', { link='Operator' })
1257
+ hi('CmpItemKindProperty', { link='Structure' })
1258
+ hi('CmpItemKindReference', { link='Tag' })
1259
+ hi('CmpItemKindSnippet', { link='Special' })
1260
+ hi('CmpItemKindStruct', { link='Structure' })
1261
+ hi('CmpItemKindText', { link='Normal' })
1262
+ hi('CmpItemKindTypeParameter', { link='Type' })
1263
+ hi('CmpItemKindUnit', { link='Special' })
1264
+ hi('CmpItemKindValue', { link='Identifier' })
1265
+ hi('CmpItemKindVariable', { link='Delimiter' })
1266
+ end
1267
+
1268
+ if has_integration('ibhagwan/fzf-lua') then
1269
+ hi('FzfLuaBufFlagAlt', { link='Special' })
1270
+ hi('FzfLuaBufFlagCur', { link='CursorLineNr' })
1271
+ hi('FzfLuaBufNr', { link='DiagnosticHint' })
1272
+ hi('FzfLuaHeaderBind', { link='DiagnosticWarn' })
1273
+ hi('FzfLuaHeaderText', { link='DiagnosticInfo' })
1274
+ hi('FzfLuaLiveSym', { link='DiagnosticHint' })
1275
+ hi('FzfLuaPathColNr', { link='DiagnosticHint' })
1276
+ hi('FzfLuaPathLineNr', { link='DiagnosticInfo' })
1277
+ hi('FzfLuaTabMarker', { link='DiagnosticHint' })
1278
+ hi('FzfLuaTabTitle', { link='Title' })
1279
+ hi('FzfLuaTitle', { link='FloatTitle' })
1280
+ end
1281
+
1282
+ if has_integration('justinmk/vim-sneak') then
1283
+ hi('Sneak', { fg=p.bg, bg=p.orange })
1284
+ hi('SneakScope', { fg=p.bg, bg=p.fg_edge2 })
1285
+ hi('SneakLabel', { fg=p.bg, bg=p.orange, bold=true })
1286
+ end
1287
+
1288
+ -- 'kevinhwang91/nvim-bqf'
1289
+ if has_integration('kevinhwang91/nvim-bqf') then
1290
+ hi('BqfPreviewFloat', { link='NormalFloat' })
1291
+ hi('BqfPreviewTitle', { link='FloatTitle' })
1292
+ hi('BqfSign', { fg=p.cyan })
1293
+ end
1294
+
1295
+ -- 'kevinhwang91/nvim-ufo'
1296
+ -- Everything works correctly out of the box
1297
+
1298
+ if has_integration('lewis6991/gitsigns.nvim') then
1299
+ hi('GitSignsAdd', { fg=p.green, bg=nil })
1300
+ hi('GitSignsAddLn', { link='GitSignsAdd' })
1301
+ hi('GitSignsAddInline', { link='GitSignsAdd' })
1302
+
1303
+ hi('GitSignsChange', { fg=p.yellow, bg=nil })
1304
+ hi('GitSignsChangeLn', { link='GitSignsChange' })
1305
+ hi('GitSignsChangeInline', { link='GitSignsChange' })
1306
+
1307
+ hi('GitSignsDelete', { fg=p.red, bg=nil })
1308
+ hi('GitSignsDeleteLn', { link='GitSignsDelete' })
1309
+ hi('GitSignsDeleteInline', { link='GitSignsDelete' })
1310
+
1311
+ hi('GitSignsUntracked', { fg=p.azure, bg=nil })
1312
+ hi('GitSignsUntrackedLn', { link='GitSignsUntracked' })
1313
+ hi('GitSignsUntrackedInline', { link='GitSignsUntracked' })
1314
+ end
1315
+
1316
+ if has_integration('lukas-reineke/indent-blankline.nvim') then
1317
+ hi('IndentBlanklineChar', { fg=p.bg_mid2, bg=nil, nocombine=true })
1318
+ hi('IndentBlanklineContextChar', { fg=p.accent, bg=nil, nocombine=true })
1319
+ hi('IndentBlanklineContextStart', { fg=nil, bg=nil, sp=p.accent, underline=true, nocombine=true })
1320
+ hi('IndentBlanklineIndent1', { fg=p.blue, bg=nil, nocombine=true })
1321
+ hi('IndentBlanklineIndent2', { fg=p.cyan, bg=nil, nocombine=true })
1322
+ hi('IndentBlanklineIndent3', { fg=p.yellow, bg=nil, nocombine=true })
1323
+ hi('IndentBlanklineIndent4', { fg=p.red, bg=nil, nocombine=true })
1324
+ hi('IndentBlanklineIndent5', { fg=p.azure, bg=nil, nocombine=true })
1325
+ hi('IndentBlanklineIndent6', { fg=p.green, bg=nil, nocombine=true })
1326
+ hi('IndentBlanklineIndent7', { fg=p.orange, bg=nil, nocombine=true })
1327
+ hi('IndentBlanklineIndent8', { fg=p.purple, bg=nil, nocombine=true })
1328
+ end
1329
+
1330
+ if has_integration('MeanderingProgrammer/render-markdown.nvim') then
1331
+ hi('RenderMarkdownBullet', { fg=p.accent, bg=nil })
1332
+ hi('RenderMarkdownChecked', { link='DiagnosticOk' })
1333
+ hi('RenderMarkdownCode', { fg=nil, bg=p.bg_edge })
1334
+ hi('RenderMarkdownCodeInline', { fg=nil, bg=p.bg_edge })
1335
+ hi('RenderMarkdownDash', { fg=p.accent, bg=nil })
1336
+ hi('RenderMarkdownH1', { fg=p.orange, bg=nil })
1337
+ hi('RenderMarkdownH1Bg', { fg=nil, bg=p.orange_bg })
1338
+ hi('RenderMarkdownH2', { fg=p.yellow, bg=nil })
1339
+ hi('RenderMarkdownH2Bg', { fg=nil, bg=p.yellow_bg })
1340
+ hi('RenderMarkdownH3', { fg=p.green, bg=nil })
1341
+ hi('RenderMarkdownH3Bg', { fg=nil, bg=p.green_bg })
1342
+ hi('RenderMarkdownH4', { fg=p.cyan, bg=nil })
1343
+ hi('RenderMarkdownH4Bg', { fg=nil, bg=p.cyan_bg })
1344
+ hi('RenderMarkdownH5', { fg=p.azure, bg=nil })
1345
+ hi('RenderMarkdownH5Bg', { fg=nil, bg=p.azure_bg })
1346
+ hi('RenderMarkdownH6', { fg=p.blue, bg=nil })
1347
+ hi('RenderMarkdownH6Bg', { fg=nil, bg=p.blue_bg })
1348
+ hi('RenderMarkdownTodo', { link='Todo' })
1349
+ hi('RenderMarkdownUnchecked', { link='DiagnosticWarn' })
1350
+ end
1351
+
1352
+ if has_integration('neoclide/coc.nvim') then
1353
+ hi('CocCodeLens', { link='LspCodeLens' })
1354
+ hi('CocDisabled', { link='Comment' })
1355
+ hi('CocFadeOut', { link='Comment' })
1356
+ hi('CocMarkdownLink', { fg=p.blue, bg=nil })
1357
+ hi('CocMenuSel', { fg=nil, bg=p.bg_mid2 })
1358
+ hi('CocNotificationProgress', { link='CocMarkdownLink' })
1359
+ hi('CocPumVirtualText', { link='CocMarkdownLink' })
1360
+ hi('CocSearch', { fg=p.blue, bg=nil })
1361
+ hi('CocSelectedText', { fg=p.yellow, bg=nil })
1362
+ end
1363
+
1364
+ -- NeogitOrg/neogit
1365
+ if has_integration('NeogitOrg/neogit') then
1366
+ hi('NeogitCommitViewHeader', { link='Special' })
1367
+ hi('NeogitDiffAddHighlight', { link='DiffAdd' })
1368
+ hi('NeogitDiffAdd', { link='DiffAdd' })
1369
+ hi('NeogitDiffDeleteHighlight', { link='DiffDelete' })
1370
+ hi('NeogitDiffDelete', { link='DiffDelete' })
1371
+ hi('NeogitFold', { link='FoldColumn' })
1372
+ hi('NeogitHunkHeader', { fg=p.accent, bg=nil })
1373
+ hi('NeogitHunkHeaderHighlight', { fg=p.accent, bg=nil, bold=true })
1374
+ hi('NeogitNotificationError', { link='DiagnosticError' })
1375
+ hi('NeogitNotificationInfo', { link='DiagnosticInfo' })
1376
+ hi('NeogitNotificationWarning', { link='DiagnosticWarn' })
1377
+ end
1378
+
1379
+ -- nvim-lualine/lualine.nvim
1380
+ -- Everything works correctly out of the box
1381
+
1382
+ if has_integration('nvim-neo-tree/neo-tree.nvim') then
1383
+ hi('NeoTreeDimText', { fg=p.bg_mid2, bg=nil })
1384
+ hi('NeoTreeDotfile', { fg=p.fg_mid, bg=nil })
1385
+ hi('NeoTreeFadeText1', { link='NeoTreeDimText' })
1386
+ hi('NeoTreeFadeText2', { fg=p.bg_mid2, bg=nil })
1387
+ hi('NeoTreeGitAdded', { fg=p.green, bg=nil })
1388
+ hi('NeoTreeGitConflict', { fg=p.orange, bg=nil, bold=true })
1389
+ hi('NeoTreeGitDeleted', { fg=p.red, bg=nil })
1390
+ hi('NeoTreeGitModified', { fg=p.yellow, bg=nil })
1391
+ hi('NeoTreeGitUnstaged', { fg=p.purple, bg=nil })
1392
+ hi('NeoTreeGitUntracked', { fg=p.cyan, bg=nil })
1393
+ hi('NeoTreeMessage', { fg=p.fg, bg=p.bg_mid })
1394
+ hi('NeoTreeModified', { fg=p.fg_edge, bg=nil })
1395
+ hi('NeoTreeRootName', { fg=p.accent, bg=nil, bold=true })
1396
+ hi('NeoTreeTabInactive', { fg=p.fg_mid2, bg=nil })
1397
+ hi('NeoTreeTabSeparatorActive', { fg=p.fg_mid2, bg=p.bg_mid2 })
1398
+ hi('NeoTreeTabSeparatorInactive', { fg=p.bg_mid, bg=p.bg_mid })
1399
+ end
1400
+
1401
+ if has_integration('nvim-telescope/telescope.nvim') then
1402
+ hi('TelescopeBorder', { fg=p.accent, bg=nil })
1403
+ hi('TelescopeMatching', { fg=nil, bg=nil, bold=true })
1404
+ hi('TelescopeMultiSelection', { fg=nil, bg=p.bg_mid2 })
1405
+ hi('TelescopeSelection', { fg=nil, bg=p.bg_mid })
1406
+ end
1407
+
1408
+ if has_integration('nvim-tree/nvim-tree.lua') then
1409
+ hi('NvimTreeExecFile', { fg=p.green, bg=nil, bold=true })
1410
+ hi('NvimTreeFolderIcon', { fg=p.fg_mid2, bg=nil })
1411
+ hi('NvimTreeGitDeleted', { fg=p.red, bg=nil })
1412
+ hi('NvimTreeGitDirty', { fg=p.yellow, bg=nil })
1413
+ hi('NvimTreeGitMerge', { fg=p.orange, bg=nil })
1414
+ hi('NvimTreeGitNew', { fg=p.cyan, bg=nil })
1415
+ hi('NvimTreeGitRenamed', { fg=p.purple, bg=nil })
1416
+ hi('NvimTreeGitStaged', { fg=p.green, bg=nil })
1417
+ hi('NvimTreeImageFile', { fg=p.orange, bg=nil })
1418
+ hi('NvimTreeIndentMarker', { link='NvimTreeFolderIcon' })
1419
+ hi('NvimTreeOpenedFile', { link='NvimTreeExecFile' })
1420
+ hi('NvimTreeRootFolder', { fg=p.accent, bg=nil, bold=true })
1421
+ hi('NvimTreeSpecialFile', { fg=p.accent, bg=nil, underline=true })
1422
+ hi('NvimTreeSymlink', { fg=p.blue, bg=nil, bold=true })
1423
+ hi('NvimTreeWindowPicker', { fg=p.fg, bg=p.bg_mid2, bold=true })
1424
+ end
1425
+
1426
+ if has_integration('OXY2DEV/helpview.nvim') then
1427
+ hi('HelpviewCode', { fg=nil, bg=p.bg_edge })
1428
+ hi('HelpviewCodeLanguage', { fg=nil, bg=p.bg_edge })
1429
+ hi('HelpviewHeading1', { link='@markup.heading.1' })
1430
+ hi('HelpviewHeading2', { link='@markup.heading.2' })
1431
+ hi('HelpviewHeading3', { link='@markup.heading.3' })
1432
+ hi('HelpviewHeading4', { link='@markup.heading.4' })
1433
+ hi('HelpviewInlineCode', { fg=nil, bg=p.bg_edge })
1434
+ hi('HelpviewMentionlink', { fg=p.accent, bg=nil, underline=true })
1435
+ hi('HelpviewOptionlink', { fg=p.yellow, bg=nil, underline=true })
1436
+ hi('HelpviewTaglink', { fg=p.accent, bg=nil, bold=true })
1437
+ hi('HelpviewTitle', { link='Title' })
1438
+ end
1439
+
1440
+ if has_integration('OXY2DEV/markview.nvim') then
1441
+ hi('MarkviewPalette0', { fg=p.accent, bg=p.accent_bg })
1442
+ hi('MarkviewPalette0Fg', { fg=p.accent, bg=nil })
1443
+ hi('MarkviewPalette0Bg', { fg=nil, bg=p.accent_bg })
1444
+ hi('MarkviewPalette0Sign', { fg=p.accent, bg=nil })
1445
+ hi('MarkviewPalette1', { fg=p.red, bg=p.red_bg })
1446
+ hi('MarkviewPalette1Fg', { fg=p.red, bg=nil })
1447
+ hi('MarkviewPalette1Bg', { fg=nil, bg=p.red_bg })
1448
+ hi('MarkviewPalette1Sign', { fg=p.red, bg=nil })
1449
+ hi('MarkviewPalette2', { fg=p.orange, bg=p.orange_bg })
1450
+ hi('MarkviewPalette2Fg', { fg=p.orange, bg=nil })
1451
+ hi('MarkviewPalette2Bg', { fg=nil, bg=p.orange_bg })
1452
+ hi('MarkviewPalette2Sign', { fg=p.orange, bg=nil })
1453
+ hi('MarkviewPalette3', { fg=p.yellow, bg=p.yellow_bg })
1454
+ hi('MarkviewPalette3Fg', { fg=p.yellow, bg=nil })
1455
+ hi('MarkviewPalette3Bg', { fg=nil, bg=p.yellow_bg })
1456
+ hi('MarkviewPalette3Sign', { fg=p.yellow, bg=nil })
1457
+ hi('MarkviewPalette4', { fg=p.green, bg=p.green_bg })
1458
+ hi('MarkviewPalette4Fg', { fg=p.green, bg=nil })
1459
+ hi('MarkviewPalette4Bg', { fg=nil, bg=p.green_bg })
1460
+ hi('MarkviewPalette4Sign', { fg=p.green, bg=nil })
1461
+ hi('MarkviewPalette5', { fg=p.cyan, bg=p.cyan_bg })
1462
+ hi('MarkviewPalette5Fg', { fg=p.cyan, bg=nil })
1463
+ hi('MarkviewPalette5Bg', { fg=nil, bg=p.cyan_bg })
1464
+ hi('MarkviewPalette5Sign', { fg=p.cyan, bg=nil })
1465
+ hi('MarkviewPalette6', { fg=p.azure, bg=p.azure_bg })
1466
+ hi('MarkviewPalette6Fg', { fg=p.azure, bg=nil })
1467
+ hi('MarkviewPalette6Bg', { fg=nil, bg=p.azure_bg })
1468
+ hi('MarkviewPalette6Sign', { fg=p.azure, bg=nil })
1469
+ hi('MarkviewPalette7', { fg=p.blue, bg=p.blue_bg })
1470
+ hi('MarkviewPalette7Fg', { fg=p.blue, bg=nil })
1471
+ hi('MarkviewPalette7Bg', { fg=nil, bg=p.blue_bg })
1472
+ hi('MarkviewPalette7Sign', { fg=p.blue, bg=nil })
1473
+ end
1474
+
1475
+ if has_integration('phaazon/hop.nvim') then
1476
+ hi('HopNextKey', { fg=p.green, bg=nil, bold=true, nocombine=true })
1477
+ hi('HopNextKey1', { fg=p.orange, bg=nil, bold=true, nocombine=true })
1478
+ hi('HopNextKey2', { fg=p.fg_mid, bg=nil, bold=true, nocombine=true })
1479
+ hi('HopPreview', { fg=p.yellow, bg=nil, bold=true, nocombine=true })
1480
+ hi('HopUnmatched', { fg=p.bg_mid2, bg=nil })
1481
+ end
1482
+
1483
+ if has_integration('rcarriga/nvim-dap-ui') then
1484
+ hi('DapUIScope', { link='Title' })
1485
+ hi('DapUIType', { link='Type' })
1486
+ hi('DapUIModifiedValue', { fg=p.orange, bg=nil, bold=true })
1487
+ hi('DapUIDecoration', { link='Title' })
1488
+ hi('DapUIThread', { link='String' })
1489
+ hi('DapUIStoppedThread', { link='Title' })
1490
+ hi('DapUISource', { link='Directory' })
1491
+ hi('DapUILineNumber', { link='Title' })
1492
+ hi('DapUIFloatBorder', { link='SpecialChar' })
1493
+ hi('DapUIWatchesEmpty', { link='ErrorMsg' })
1494
+ hi('DapUIWatchesValue', { link='String' })
1495
+ hi('DapUIWatchesError', { link='DiagnosticError' })
1496
+ hi('DapUIBreakpointsPath', { link='Directory' })
1497
+ hi('DapUIBreakpointsInfo', { link='DiagnosticInfo' })
1498
+ hi('DapUIBreakpointsCurrentLine', { fg=p.green, bg=nil, bold=true })
1499
+ hi('DapUIBreakpointsDisabledLine', { link='Comment' })
1500
+ end
1501
+
1502
+ if has_integration('rcarriga/nvim-notify') then
1503
+ hi('NotifyDEBUGBorder', { fg=p.green, bg=nil })
1504
+ hi('NotifyDEBUGIcon', { link='NotifyDEBUGBorder' })
1505
+ hi('NotifyDEBUGTitle', { link='NotifyDEBUGBorder' })
1506
+ hi('NotifyERRORBorder', { fg=p.red, bg=nil })
1507
+ hi('NotifyERRORIcon', { link='NotifyERRORBorder' })
1508
+ hi('NotifyERRORTitle', { link='NotifyERRORBorder' })
1509
+ hi('NotifyINFOBorder', { fg=p.blue, bg=nil })
1510
+ hi('NotifyINFOIcon', { link='NotifyINFOBorder' })
1511
+ hi('NotifyINFOTitle', { link='NotifyINFOBorder' })
1512
+ hi('NotifyTRACEBorder', { fg=p.cyan, bg=nil })
1513
+ hi('NotifyTRACEIcon', { link='NotifyTRACEBorder' })
1514
+ hi('NotifyTRACETitle', { link='NotifyTRACEBorder' })
1515
+ hi('NotifyWARNBorder', { fg=p.yellow, bg=nil })
1516
+ hi('NotifyWARNIcon', { link='NotifyWARNBorder' })
1517
+ hi('NotifyWARNTitle', { link='NotifyWARNBorder' })
1518
+ end
1519
+
1520
+ if has_integration('rlane/pounce.nvim') then
1521
+ hi('PounceMatch', { fg=p.bg, bg=p.fg, bold=true, nocombine=true })
1522
+ hi('PounceGap', { fg=p.bg, bg=p.bg_mid2, bold=true, nocombine=true })
1523
+ hi('PounceAccept', { fg=p.bg, bg=p.yellow, bold=true, nocombine=true })
1524
+ hi('PounceAcceptBest', { fg=p.bg, bg=p.green, bold=true, nocombine=true })
1525
+ end
1526
+
1527
+ if has_integration('romgrk/barbar.nvim') then
1528
+ hi('BufferCurrent', { fg=p.accent, bg=p.bg, bold=true })
1529
+ hi('BufferCurrentIcon', { fg=nil, bg=p.bg })
1530
+ hi('BufferCurrentIndex', { link='BufferCurrentIcon' })
1531
+ hi('BufferCurrentMod', { fg=p.accent, bg=p.bg_mid, bold=true })
1532
+ hi('BufferCurrentSign', { link='BufferCurrent' })
1533
+ hi('BufferCurrentTarget', { fg=p.accent, bg=p.bg_mid2, bold=true })
1534
+
1535
+ hi('BufferInactive', { fg=p.fg, bg=p.bg_edge })
1536
+ hi('BufferInactiveIcon', { fg=nil, bg=p.bg_edge })
1537
+ hi('BufferInactiveIndex', { link='BufferInactiveIcon' })
1538
+ hi('BufferInactiveMod', { fg=p.fg, bg=p.bg_mid })
1539
+ hi('BufferInactiveSign', { link='BufferInactive' })
1540
+ hi('BufferInactiveTarget', { fg=p.fg, bg=p.bg_mid2 })
1541
+
1542
+ hi('BufferOffset', { link='Normal' })
1543
+ hi('BufferTabpages', { fg=p.bg, bg=p.green, bold=true })
1544
+ hi('BufferTabpageFill', { link='Normal' })
1545
+
1546
+ hi('BufferVisible', { fg=p.fg, bg=p.bg, bold=true })
1547
+ hi('BufferVisibleIcon', { fg=nil, bg=p.bg })
1548
+ hi('BufferVisibleIndex', { link='BufferVisibleIcon' })
1549
+ hi('BufferVisibleMod', { fg=p.fg, bg=p.bg_mid, bold=true })
1550
+ hi('BufferVisibleSign', { link='BufferVisible' })
1551
+ hi('BufferVisibleTarget', { fg=p.fg, bg=p.bg_mid2, bold=true })
1552
+ end
1553
+
1554
+ if has_integration('saghen/blink.cmp') then
1555
+ hi('BlinkCmpLabelDeprecated', { link='Comment' })
1556
+ hi('BlinkCmpLabelMatch', { fg=nil, bg=nil, bold=true })
1557
+
1558
+ hi('BlinkCmpKindClass', { link='Type' })
1559
+ hi('BlinkCmpKindColor', { link='Special' })
1560
+ hi('BlinkCmpKindConstant', { link='Constant' })
1561
+ hi('BlinkCmpKindConstructor', { link='Type' })
1562
+ hi('BlinkCmpKindEnum', { link='Structure' })
1563
+ hi('BlinkCmpKindEnumMember', { link='Structure' })
1564
+ hi('BlinkCmpKindEvent', { link='Exception' })
1565
+ hi('BlinkCmpKindField', { link='Structure' })
1566
+ hi('BlinkCmpKindFile', { link='Tag' })
1567
+ hi('BlinkCmpKindFolder', { link='Directory' })
1568
+ hi('BlinkCmpKindFunction', { link='Function' })
1569
+ hi('BlinkCmpKindInterface', { link='Structure' })
1570
+ hi('BlinkCmpKindKeyword', { link='Keyword' })
1571
+ hi('BlinkCmpKindMethod', { link='Function' })
1572
+ hi('BlinkCmpKindModule', { link='Structure' })
1573
+ hi('BlinkCmpKindOperator', { link='Operator' })
1574
+ hi('BlinkCmpKindProperty', { link='Structure' })
1575
+ hi('BlinkCmpKindReference', { link='Tag' })
1576
+ hi('BlinkCmpKindSnippet', { link='Special' })
1577
+ hi('BlinkCmpKindStruct', { link='Structure' })
1578
+ hi('BlinkCmpKindText', { link='Normal' })
1579
+ hi('BlinkCmpKindTypeParameter', { link='Type' })
1580
+ hi('BlinkCmpKindUnit', { link='Special' })
1581
+ hi('BlinkCmpKindValue', { link='Identifier' })
1582
+ hi('BlinkCmpKindVariable', { link='Delimiter' })
1583
+ end
1584
+
1585
+ -- stevearc/aerial.nvim
1586
+ -- Everything works correctly out of the box
1587
+
1588
+ if has_integration('williamboman/mason.nvim') then
1589
+ hi('MasonError', { fg=p.red, bg=nil })
1590
+ hi('MasonHeader', { fg=p.bg, bg=p.azure, bold=true })
1591
+ hi('MasonHeaderSecondary', { fg=p.bg, bg=p.blue, bold=true })
1592
+ hi('MasonHeading', { link='Bold' })
1593
+ hi('MasonHighlight', { fg=p.accent, bg=nil })
1594
+ hi('MasonHighlightBlock', { fg=p.bg, bg=p.accent })
1595
+ hi('MasonHighlightBlockBold', { link='MasonHeaderSecondary' })
1596
+ hi('MasonHighlightBlockBoldSecondary', { link='MasonHeader' })
1597
+ hi('MasonHighlightBlockSecondary', { fg=p.bg, bg=p.azure })
1598
+ hi('MasonHighlightSecondary', { fg=p.azure, bg=nil })
1599
+ hi('MasonLink', { link='MasonHighlight' })
1600
+ hi('MasonMuted', { link='Comment' })
1601
+ hi('MasonMutedBlock', { fg=p.bg, bg=p.bg_mid2 })
1602
+ hi('MasonMutedBlockBold', { fg=p.bg, bg=p.bg_mid2, bold=true })
1603
+ end
1604
+
1605
+ -- Terminal colors
1606
+ local is_bg_dark = H.hex2oklch(p.bg).l < H.hex2oklch(p.fg).l
1607
+ local black = is_bg_dark and 'bg' or 'fg'
1608
+ local white = is_bg_dark and 'fg' or 'bg'
1609
+ vim.g.terminal_color_0 = p[black .. '_edge2']
1610
+ vim.g.terminal_color_1 = p.red
1611
+ vim.g.terminal_color_2 = p.green
1612
+ vim.g.terminal_color_3 = p.yellow
1613
+ vim.g.terminal_color_4 = p.azure
1614
+ vim.g.terminal_color_5 = p.purple
1615
+ vim.g.terminal_color_6 = p.cyan
1616
+ vim.g.terminal_color_7 = p[white .. '_mid2']
1617
+ vim.g.terminal_color_8 = p[black .. '_mid2']
1618
+ vim.g.terminal_color_9 = p.red
1619
+ vim.g.terminal_color_10 = p.green
1620
+ vim.g.terminal_color_11 = p.yellow
1621
+ vim.g.terminal_color_12 = p.azure
1622
+ vim.g.terminal_color_13 = p.purple
1623
+ vim.g.terminal_color_14 = p.cyan
1624
+ vim.g.terminal_color_15 = p[white .. '_edge2']
1625
+ end
1626
+
1627
+ --- Get latest applied palette
1628
+ ---
1629
+ ---@return table Table with structure as |MiniHues.make_palette()| output that was
1630
+ --- the latest applied (via |MiniHues.apply_palette()|) palette.
1631
+ MiniHues.get_palette = function() return vim.deepcopy(H.palette) end
1632
+
1633
+ --- Generate random base colors
1634
+ ---
1635
+ --- Compute background and foreground colors based on randomly generated hue
1636
+ --- and heuristically picked lightness-chroma values.
1637
+ ---
1638
+ --- You can recreate a similar functionality but tweaked to your taste
1639
+ --- using |mini.colors|: >lua
1640
+ ---
1641
+ --- local convert = require('mini.colors').convert
1642
+ --- local hue = math.random(0, 359)
1643
+ --- return {
1644
+ --- background = convert({ l = 15, c = 3, h = hue }, 'hex'),
1645
+ --- foreground = convert({ l = 80, c = 1, h = hue }, 'hex'),
1646
+ --- }
1647
+ --- <
1648
+ --- Notes:
1649
+ --- - Respects |'background'| (uses different lightness and chroma values for
1650
+ --- "dark" and "light" backgrounds).
1651
+ ---
1652
+ --- - When used during startup, might require usage of `math.randomseed()` for
1653
+ --- proper random generation. For example: >lua
1654
+ ---
1655
+ --- local hues = require('mini.hues')
1656
+ --- math.randomseed(vim.loop.hrtime())
1657
+ --- hues.setup(hues.gen_random_base_colors())
1658
+ --- <
1659
+ ---@param opts table|nil Options. Possible values:
1660
+ --- - <gen_hue> `(function)` - callable which will return single number for
1661
+ --- output hue. Can be used to limit which hues will be generated.
1662
+ --- Default: random integer between 0 and 359.
1663
+ ---
1664
+ ---@return table Table with <background> and <foreground> fields containing
1665
+ --- color hex strings.
1666
+ MiniHues.gen_random_base_colors = function(opts)
1667
+ opts = opts or {}
1668
+ local gen_hue = opts.gen_hue or function() return math.random(0, 359) end
1669
+ if not vim.is_callable(gen_hue) then H.error('`gen_hue` should be callable.') end
1670
+
1671
+ local is_dark = vim.o.background == 'dark'
1672
+ local bg_l = is_dark and 15 or 90
1673
+ local fg_l = is_dark and 80 or 20
1674
+ local bg_c = is_dark and 3 or 1
1675
+
1676
+ local hue = gen_hue() % 360
1677
+ --stylua: ignore
1678
+ return {
1679
+ background = H.oklch2hex({ l = bg_l, c = bg_c, h = hue }),
1680
+ foreground = H.oklch2hex({ l = fg_l, c = 1, h = hue }),
1681
+ }
1682
+ end
1683
+
1684
+ -- Helper data ================================================================
1685
+ -- Module default config
1686
+ H.default_config = vim.deepcopy(MiniHues.config)
1687
+
1688
+ -- Color conversion constants
1689
+ H.tau = 2 * math.pi
1690
+
1691
+ H.saturation_values = { 'low', 'lowmedium', 'medium', 'mediumhigh', 'high' }
1692
+
1693
+ H.accent_values = { 'bg', 'fg', 'red', 'orange', 'yellow', 'green', 'cyan', 'azure', 'blue', 'purple' }
1694
+
1695
+ -- Cusps for Oklch color space. See 'mini.colors' for more details.
1696
+ --stylua: ignore start
1697
+ ---@diagnostic disable
1698
+ ---@private
1699
+ H.cusps = {
1700
+ [0] = {26.23,64.74},
1701
+ {26.14,64.65},{26.06,64.56},{25.98,64.48},{25.91,64.39},{25.82,64.29},{25.76,64.21},{25.70,64.13},{25.65,64.06},
1702
+ {25.59,63.97},{25.55,63.90},{25.52,63.83},{25.48,63.77},{25.45,63.69},{25.43,63.63},{25.41,63.55},{25.40,63.50},
1703
+ {25.39,63.43},{25.40,63.33},{25.40,63.27},{25.42,63.22},{25.44,63.15},{25.46,63.11},{25.50,63.05},{25.53,63.00},
1704
+ {25.58,62.95},{25.63,62.90},{25.69,62.85},{25.75,62.81},{25.77,62.80},{25.34,63.25},{24.84,63.79},{24.37,64.32},
1705
+ {23.92,64.83},{23.48,65.35},{23.08,65.85},{22.65,66.38},{22.28,66.86},{21.98,67.27},{21.67,67.70},{21.36,68.14},
1706
+ {21.05,68.60},{20.74,69.08},{20.50,69.45},{20.27,69.83},{20.04,70.22},{19.82,70.62},{19.60,71.03},{19.38,71.44},
1707
+ {19.17,71.87},{19.03,72.16},{18.83,72.59},{18.71,72.89},{18.52,73.34},{18.40,73.64},{18.28,73.95},{18.17,74.26},
1708
+ {18.01,74.74},{17.91,75.05},{17.82,75.38},{17.72,75.70},{17.64,76.03},{17.56,76.36},{17.48,76.69},{17.41,77.03},
1709
+ {17.35,77.36},{17.29,77.71},{17.24,78.05},{17.19,78.39},{17.15,78.74},{17.12,79.09},{17.09,79.45},{17.07,79.80},
1710
+ {17.05,80.16},{17.04,80.52},{17.04,81.06},{17.04,81.42},{17.05,81.79},{17.07,82.16},{17.08,82.53},{17.11,82.72},
1711
+ {17.14,83.09},{17.18,83.46},{17.22,83.84},{17.27,84.22},{17.33,84.60},{17.39,84.98},{17.48,85.56},{17.56,85.94},
1712
+ {17.64,86.33},{17.73,86.72},{17.81,87.10},{17.91,87.50},{18.04,88.09},{18.16,88.48},{18.27,88.88},{18.40,89.48},
1713
+ {18.57,89.87},{18.69,90.27},{18.88,90.87},{19.03,91.48},{19.22,91.88},{19.44,92.49},{19.66,93.10},{19.85,93.71},
1714
+ {20.04,94.33},{20.33,94.94},{20.60,95.56},{20.85,96.18},{21.10,96.80},{21.19,96.48},{21.27,96.24},{21.38,95.93},
1715
+ {21.47,95.70},{21.59,95.40},{21.72,95.10},{21.86,94.80},{21.97,94.58},{22.12,94.30},{22.27,94.02},{22.43,93.74},
1716
+ {22.64,93.40},{22.81,93.14},{23.04,92.81},{23.22,92.56},{23.45,92.25},{23.68,91.95},{23.92,91.65},{24.21,91.31},
1717
+ {24.45,91.04},{24.74,90.72},{25.08,90.36},{25.37,90.07},{25.70,89.74},{26.08,89.39},{26.44,89.07},{26.87,88.69},
1718
+ {27.27,88.34},{27.72,87.98},{28.19,87.61},{28.68,87.23},{29.21,86.84},{29.48,86.64},{28.99,86.70},{28.13,86.81},
1719
+ {27.28,86.92},{26.56,87.02},{25.83,87.12},{25.18,87.22},{24.57,87.32},{24.01,87.41},{23.53,87.49},{23.03,87.58},
1720
+ {22.53,87.68},{22.10,87.76},{21.68,87.84},{21.26,87.93},{20.92,88.01},{20.58,88.08},{20.25,88.16},{19.92,88.24},
1721
+ {19.59,88.33},{19.35,88.39},{19.12,88.46},{18.81,88.55},{18.58,88.61},{18.36,88.68},{18.14,88.76},{17.93,88.83},
1722
+ {17.79,88.88},{17.59,88.95},{17.39,89.03},{17.26,89.08},{17.08,89.16},{16.96,89.21},{16.79,89.29},{16.68,89.35},
1723
+ {16.58,89.41},{16.43,89.49},{16.33,89.55},{16.24,89.60},{16.16,89.66},{16.04,89.75},{15.96,89.81},{15.89,89.87},
1724
+ {15.83,89.93},{15.77,89.99},{15.71,90.05},{15.66,90.12},{15.61,90.18},{15.57,90.24},{15.54,90.31},{15.51,90.37},
1725
+ {15.48,90.44},{15.46,90.51},{15.40,90.30},{15.30,89.83},{15.21,89.36},{15.12,88.89},{15.03,88.67},{14.99,88.18},
1726
+ {14.92,87.71},{14.85,87.24},{14.78,86.77},{14.75,86.53},{14.70,86.06},{14.65,85.59},{14.61,85.12},{14.60,84.89},
1727
+ {14.57,84.42},{14.54,83.94},{14.53,83.71},{14.52,83.24},{14.51,82.77},{14.52,82.30},{14.52,81.83},{14.53,81.60},
1728
+ {14.55,81.13},{14.58,80.66},{14.59,80.43},{14.63,79.96},{14.68,79.49},{14.70,79.26},{14.76,78.79},{14.82,78.32},
1729
+ {14.85,78.09},{14.93,77.62},{15.01,77.16},{15.10,76.69},{15.19,76.23},{15.24,76.00},{15.34,75.54},{15.45,75.07},
1730
+ {15.57,74.61},{15.69,74.15},{15.82,73.69},{15.96,73.23},{16.10,72.77},{16.24,72.31},{16.39,71.86},{16.55,71.40},
1731
+ {16.71,70.95},{16.96,70.26},{17.14,69.81},{17.32,69.36},{17.59,68.69},{17.88,68.02},{18.07,67.57},{18.37,66.90},
1732
+ {18.67,66.24},{18.99,65.58},{19.30,64.93},{19.74,64.06},{20.07,63.42},{20.51,62.57},{20.97,61.73},{21.54,60.69},
1733
+ {22.00,59.87},{22.70,58.66},{23.39,57.49},{24.19,56.16},{25.20,54.52},{26.38,52.66},{28.55,49.32},{31.32,45.20},
1734
+ {31.15,45.42},{30.99,45.64},{30.85,45.85},{30.72,46.06},{30.57,46.31},{30.47,46.50},{30.34,46.75},{30.23,46.97},
1735
+ {30.13,47.20},{30.03,47.45},{29.93,47.71},{29.86,47.91},{29.77,48.20},{29.71,48.43},{29.65,48.66},{29.58,48.98},
1736
+ {29.53,49.23},{29.48,49.48},{29.44,49.74},{29.41,50.01},{29.37,50.29},{29.35,50.57},{29.33,50.86},{29.31,51.16},
1737
+ {29.30,51.56},{29.29,51.87},{29.29,52.39},{29.30,52.72},{29.31,53.05},{29.33,53.38},{29.35,53.72},{29.37,54.06},
1738
+ {29.40,54.41},{29.43,54.76},{29.47,55.12},{29.52,55.60},{29.56,55.97},{29.61,56.34},{29.66,56.72},{29.73,57.22},
1739
+ {29.79,57.61},{29.84,57.99},{29.93,58.52},{29.99,58.91},{30.08,59.44},{30.15,59.84},{30.24,60.38},{30.34,60.93},
1740
+ {30.42,61.34},{30.52,61.90},{30.63,62.45},{30.73,63.02},{30.85,63.58},{30.96,64.15},{31.08,64.72},{31.19,65.30},
1741
+ {31.31,65.88},{31.44,66.46},{31.59,67.20},{31.72,67.79},{31.88,68.53},{32.01,69.12},{32.18,69.87},{32.25,70.17},
1742
+ {32.06,69.99},{31.76,69.70},{31.45,69.42},{31.21,69.20},{30.97,68.98},{30.68,68.71},{30.44,68.50},{30.21,68.29},
1743
+ {29.98,68.09},{29.75,67.89},{29.53,67.69},{29.31,67.50},{29.09,67.31},{28.88,67.12},{28.72,66.98},{28.52,66.80},
1744
+ {28.31,66.63},{28.16,66.50},{27.97,66.33},{27.78,66.17},{27.64,66.05},{27.49,65.94},{27.33,65.77},{27.20,65.66},
1745
+ {27.04,65.51},{26.92,65.40},{26.81,65.30},{26.66,65.16},{26.55,65.06},{26.45,64.96},{26.35,64.87},
1746
+ }
1747
+ --stylua: ignore end
1748
+
1749
+ -- Latest applied palette
1750
+ H.palette = nil
1751
+
1752
+ -- Helper functionality =======================================================
1753
+ -- Settings -------------------------------------------------------------------
1754
+ H.setup_config = function(config)
1755
+ H.check_type('config', config, 'table', true)
1756
+ config = vim.tbl_deep_extend('force', vim.deepcopy(H.default_config), config or {})
1757
+
1758
+ if config.background == nil or config.foreground == nil then
1759
+ H.error('`setup()` needs both `background` and `foreground`.')
1760
+ end
1761
+
1762
+ H.validate_hex(config.background, 'background')
1763
+ H.validate_hex(config.foreground, 'foreground')
1764
+ H.validate_n_hues(config.n_hues)
1765
+ if not vim.tbl_contains(H.saturation_values, config.saturation) then
1766
+ H.error('`saturation` should be one of ' .. table.concat(vim.tbl_map(vim.inspect, H.saturation_values), ', '))
1767
+ end
1768
+ if not vim.tbl_contains(H.accent_values, config.accent) then
1769
+ H.error('`accent` should be one of ' .. table.concat(vim.tbl_map(vim.inspect, H.accent_values), ', '))
1770
+ end
1771
+ H.check_type('plugins', config.plugins, 'table')
1772
+ H.check_type('autoadjust', config.autoadjust, 'boolean')
1773
+
1774
+ return config
1775
+ end
1776
+
1777
+ H.apply_config = function(config)
1778
+ MiniHues.config = config
1779
+
1780
+ -- Apply palette
1781
+ local opts = { autoadjust = config.autoadjust }
1782
+ MiniHues.apply_palette(MiniHues.make_palette(config), config.plugins, opts)
1783
+ end
1784
+
1785
+ -- Palette --------------------------------------------------------------------
1786
+ H.make_hues = function(bg_h, fg_h, n_hues)
1787
+ local res = { bg = bg_h, fg = fg_h }
1788
+ if n_hues == 0 then return res end
1789
+
1790
+ -- Generate equidistant circular grid of hues which is the most distant from
1791
+ -- background and foreground hues. Distance between two sets is assumed as
1792
+ -- minimum distance between all pairs of points.
1793
+ local period = 360 / n_hues
1794
+ local half_period = 0.5 * period
1795
+
1796
+ -- - Compute delta which determines the furthest grid
1797
+ local d
1798
+ if bg_h == nil and fg_h == nil then d = 0 end
1799
+ if bg_h ~= nil and fg_h == nil then d = (bg_h % period + half_period) % period end
1800
+ if bg_h == nil and fg_h ~= nil then d = (fg_h % period + half_period) % period end
1801
+ if bg_h ~= nil and fg_h ~= nil then
1802
+ local ref_bg, ref_fg = bg_h % period, fg_h % period
1803
+ local mid = 0.5 * (ref_bg + ref_fg)
1804
+ local mid_alt = (mid + half_period) % period
1805
+
1806
+ d = H.dist_period(mid, ref_bg, period) < H.dist_period(mid_alt, ref_bg, period) and mid_alt or mid
1807
+ end
1808
+
1809
+ local grid = {}
1810
+ for i = 0, n_hues - 1 do
1811
+ table.insert(grid, i * period + d)
1812
+ end
1813
+
1814
+ -- Normalize equidistant grid to be base 8 colors
1815
+ local dist_fun = function(x, y) return H.dist_period(x, y, 360) end
1816
+ local approx = function(ref_hue) return H.get_closest(ref_hue, grid, dist_fun) end
1817
+
1818
+ --stylua: ignore start
1819
+ res.red = approx(0)
1820
+ res.orange = approx(45)
1821
+ res.yellow = approx(90)
1822
+ res.green = approx(135)
1823
+ res.cyan = approx(180)
1824
+ res.azure = approx(225)
1825
+ res.blue = approx(270)
1826
+ res.purple = approx(315)
1827
+ --stylua: ignore end
1828
+
1829
+ return res
1830
+ end
1831
+
1832
+ H.validate_hex = function(x, name)
1833
+ if type(x) == 'string' and x:find('^#%x%x%x%x%x%x$') ~= nil then return x end
1834
+ local msg = string.format('`%s` should be hex color string in the form "#rrggbb", not %s', name, vim.inspect(x))
1835
+ H.error(msg)
1836
+ end
1837
+
1838
+ H.validate_n_hues = function(x)
1839
+ if type(x) == 'number' and 0 <= x and x <= 8 then return x end
1840
+ local msg = string.format('`n_hues` should be a number between 0 and 8', name)
1841
+ H.error(msg)
1842
+ end
1843
+
1844
+ H.validate_one_of = function(x, choices, name)
1845
+ if vim.tbl_contains(choices, x) then return x end
1846
+ local choices_string = table.concat(vim.tbl_map(vim.inspect, choices), ', ')
1847
+ local msg = string.format('`%s` should be one of %s', name, choices_string)
1848
+ H.error(msg)
1849
+ end
1850
+
1851
+ -- Color conversion -----------------------------------------------------------
1852
+ H.hex2oklch = function(hex) return H.oklab2oklch(H.rgb2oklab(H.hex2rgb(hex))) end
1853
+
1854
+ H.oklch2hex = function(lch) return H.rgb2hex(H.oklab2rgb(H.oklch2oklab(H.clip_to_gamut(lch)))) end
1855
+
1856
+ -- HEX <-> RGB in [0; 255]
1857
+ H.hex2rgb = function(hex)
1858
+ local dec = tonumber(hex:sub(2), 16)
1859
+
1860
+ local b = math.fmod(dec, 256)
1861
+ local g = math.fmod((dec - b) / 256, 256)
1862
+ local r = math.floor(dec / 65536)
1863
+
1864
+ return { r = r, g = g, b = b }
1865
+ end
1866
+
1867
+ H.rgb2hex = function(rgb)
1868
+ -- Use straightforward clipping to [0; 255] here to ensure correctness.
1869
+ -- Modify `rgb` prior to this to ensure only a small distortion.
1870
+ local r = H.clip(H.round(rgb.r), 0, 255)
1871
+ local g = H.clip(H.round(rgb.g), 0, 255)
1872
+ local b = H.clip(H.round(rgb.b), 0, 255)
1873
+
1874
+ return string.format('#%02x%02x%02x', r, g, b)
1875
+ end
1876
+
1877
+ -- RGB in [0; 255] <-> Oklab
1878
+ -- https://bottosson.github.io/posts/oklab/#converting-from-linear-srgb-to-oklab
1879
+ H.rgb2oklab = function(rgb)
1880
+ -- Convert to linear RGB
1881
+ local r, g, b = H.correct_channel(rgb.r / 255), H.correct_channel(rgb.g / 255), H.correct_channel(rgb.b / 255)
1882
+
1883
+ -- Convert to Oklab
1884
+ local l = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b
1885
+ local m = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b
1886
+ local s = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b
1887
+
1888
+ local l_, m_, s_ = H.cuberoot(l), H.cuberoot(m), H.cuberoot(s)
1889
+
1890
+ local L = 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_
1891
+ local A = 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_
1892
+ local B = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_
1893
+
1894
+ -- Explicitly convert to gray for nearly achromatic colors
1895
+ if math.abs(A) < 1e-4 then A = 0 end
1896
+ if math.abs(B) < 1e-4 then B = 0 end
1897
+
1898
+ -- Normalize to appropriate range
1899
+ return { l = H.correct_lightness(100 * L), a = 100 * A, b = 100 * B }
1900
+ end
1901
+
1902
+ H.oklab2rgb = function(lab)
1903
+ local L, A, B = 0.01 * H.correct_lightness_inv(lab.l), 0.01 * lab.a, 0.01 * lab.b
1904
+
1905
+ local l_ = L + 0.3963377774 * A + 0.2158037573 * B
1906
+ local m_ = L - 0.1055613458 * A - 0.0638541728 * B
1907
+ local s_ = L - 0.0894841775 * A - 1.2914855480 * B
1908
+
1909
+ local l = l_ * l_ * l_
1910
+ local m = m_ * m_ * m_
1911
+ local s = s_ * s_ * s_
1912
+
1913
+ --stylua: ignore
1914
+ local r = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s
1915
+ local g = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s
1916
+ local b = -0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s
1917
+
1918
+ return { r = 255 * H.correct_channel_inv(r), g = 255 * H.correct_channel_inv(g), b = 255 * H.correct_channel_inv(b) }
1919
+ end
1920
+
1921
+ -- Oklab <-> Oklch
1922
+ H.oklab2oklch = function(lab)
1923
+ local c = math.sqrt(lab.a ^ 2 + lab.b ^ 2)
1924
+ -- Treat grays specially
1925
+ local h = nil
1926
+ if c > 0 then h = H.rad2degree(math.atan2(lab.b, lab.a)) end
1927
+ return { l = lab.l, c = c, h = h }
1928
+ end
1929
+
1930
+ H.oklch2oklab = function(lch)
1931
+ -- Treat grays specially
1932
+ if lch.c <= 0 or lch.h == nil then return { l = lch.l, a = 0, b = 0 } end
1933
+
1934
+ local a = lch.c * math.cos(H.degree2rad(lch.h))
1935
+ local b = lch.c * math.sin(H.degree2rad(lch.h))
1936
+ return { l = lch.l, a = a, b = b }
1937
+ end
1938
+
1939
+ -- Degree in [0; 360] <-> Radian in [0; 2*pi]
1940
+ H.rad2degree = function(x) return (x % H.tau) * 360 / H.tau end
1941
+
1942
+ H.degree2rad = function(x) return (x % 360) * H.tau / 360 end
1943
+
1944
+ -- Functions for RGB channel correction. Assumes input in [0; 1] range
1945
+ -- https://bottosson.github.io/posts/colorwrong/#what-can-we-do%3F
1946
+ H.correct_channel = function(x) return 0.04045 < x and math.pow((x + 0.055) / 1.055, 2.4) or (x / 12.92) end
1947
+
1948
+ H.correct_channel_inv = function(x)
1949
+ return (0.0031308 >= x) and (12.92 * x) or (1.055 * math.pow(x, 0.416666667) - 0.055)
1950
+ end
1951
+
1952
+ -- Functions for lightness correction
1953
+ -- https://bottosson.github.io/posts/colorpicker/#intermission---a-new-lightness-estimate-for-oklab
1954
+ H.correct_lightness = function(x)
1955
+ x = 0.01 * x
1956
+ local k1, k2 = 0.206, 0.03
1957
+ local k3 = (1 + k1) / (1 + k2)
1958
+
1959
+ local res = 0.5 * (k3 * x - k1 + math.sqrt((k3 * x - k1) ^ 2 + 4 * k2 * k3 * x))
1960
+ return 100 * res
1961
+ end
1962
+
1963
+ H.correct_lightness_inv = function(x)
1964
+ x = 0.01 * x
1965
+ local k1, k2 = 0.206, 0.03
1966
+ local k3 = (1 + k1) / (1 + k2)
1967
+ local res = (x / k3) * (x + k1) / (x + k2)
1968
+ return 100 * res
1969
+ end
1970
+
1971
+ -- Get gamut ranges for Lch point. More info in 'mini.colors'.
1972
+ H.get_gamut_points = function(lch)
1973
+ local c, l = lch.c, H.clip(lch.l, 0, 100)
1974
+ l = H.correct_lightness_inv(l)
1975
+ local cusp = H.cusps[math.floor(lch.h % 360)]
1976
+ local c_cusp, l_cusp = cusp[1], cusp[2]
1977
+
1978
+ -- Maximum allowed chroma. Used for computing saturation.
1979
+ local c_upper = l <= l_cusp and (c_cusp * l / l_cusp) or (c_cusp * (100 - l) / (100 - l_cusp))
1980
+ c_upper = H.clip(c_upper, 0, math.huge)
1981
+
1982
+ -- Other points can be computed only in presence of actual chroma
1983
+ if c == nil then return { c_upper = c_upper } end
1984
+
1985
+ -- Intersection of segment between (c, l) and (0, l_cusp) with gamut boundary
1986
+ -- Used for gamut clipping
1987
+ local c_cusp_clip, l_cusp_clip
1988
+ if c <= 0 then
1989
+ c_cusp_clip, l_cusp_clip = c, l
1990
+ elseif l <= l_cusp then
1991
+ -- Intersection with lower segment
1992
+ local prop = 1 - l / l_cusp
1993
+ c_cusp_clip = c_cusp * c / (c_cusp * prop + c)
1994
+ l_cusp_clip = l_cusp * c_cusp_clip / c_cusp
1995
+ else
1996
+ -- Intersection with upper segment
1997
+ local prop = 1 - (l - 100) / (l_cusp - 100)
1998
+ c_cusp_clip = c_cusp * c / (c_cusp * prop + c)
1999
+ l_cusp_clip = 100 + c_cusp_clip * (l_cusp - 100) / c_cusp
2000
+ end
2001
+
2002
+ return {
2003
+ c_upper = c_upper,
2004
+ l_cusp_clip = H.correct_lightness(l_cusp_clip),
2005
+ c_cusp_clip = c_cusp_clip,
2006
+ }
2007
+ end
2008
+
2009
+ H.clip_to_gamut = function(lch)
2010
+ local res = vim.deepcopy(lch)
2011
+
2012
+ -- Gray is always in gamut
2013
+ if res.h == nil then return res end
2014
+
2015
+ local gamut_points = H.get_gamut_points(lch)
2016
+
2017
+ local is_inside_gamut = lch.c <= gamut_points.c_upper
2018
+ if is_inside_gamut then return res end
2019
+
2020
+ -- Clip by going towards (0, l_cusp) until in gamut
2021
+ res.l, res.c = gamut_points.l_cusp_clip, gamut_points.c_cusp_clip
2022
+
2023
+ return res
2024
+ end
2025
+
2026
+ -- Auto adjusting -------------------------------------------------------------
2027
+ H.setup_autoadjust = function(palette)
2028
+ local gr = vim.api.nvim_create_augroup('MiniHuesAdjust', {})
2029
+ local hi = function(name, data) vim.api.nvim_set_hl(0, name, data) end
2030
+ local adjust = function(ev)
2031
+ local adjust_all = ev.event == 'VimEnter'
2032
+ if adjust_all or ev.match == 'fillchars' then hi('MsgSeparator', H.attr_msgseparator(palette, true)) end
2033
+ if adjust_all or ev.match == 'pumborder' then hi('Pmenu', H.attr_pmenu(palette, true)) end
2034
+ end
2035
+
2036
+ -- Use single autocommand without pattern for performance (skips Neovim doing
2037
+ -- pattern matching on the option name). Use 'VimEnter' to work when option
2038
+ -- is set during startup, as 'OptionSet' is not triggered.
2039
+ local au_opts = { group = gr, callback = adjust, desc = 'Autoadjust highlight groups' }
2040
+ vim.api.nvim_create_autocmd({ 'VimEnter', 'OptionSet' }, au_opts)
2041
+ end
2042
+
2043
+ H.attr_msgseparator = function(p, autoadjust)
2044
+ if not autoadjust then return { fg = p.accent, bg = p.bg_mid } end
2045
+ return vim.o.fillchars:find('msgsep:%S') ~= nil and { fg = p.accent } or { bg = p.bg_mid }
2046
+ end
2047
+
2048
+ H.attr_pmenu = function(p, autoadjust)
2049
+ local is_pumborder = vim.fn.exists('+pumborder') == 1 and not (vim.o.pumborder == '' or vim.o.pumborder == 'none')
2050
+ return (autoadjust and is_pumborder) and { link = 'NormalFloat' } or { fg = p.fg, bg = p.bg_mid }
2051
+ end
2052
+
2053
+ -- Utilities ------------------------------------------------------------------
2054
+ H.error = function(msg) error('(mini.hues) ' .. msg, 0) end
2055
+
2056
+ H.check_type = function(name, val, ref, allow_nil)
2057
+ if type(val) == ref or (ref == 'callable' and vim.is_callable(val)) or (allow_nil and val == nil) then return end
2058
+ H.error(string.format('`%s` should be %s, not %s', name, ref, type(val)))
2059
+ end
2060
+
2061
+ H.round = function(x)
2062
+ if x == nil then return nil end
2063
+ return math.floor(x + 0.5)
2064
+ end
2065
+
2066
+ H.clip = function(x, from, to) return math.min(math.max(x, from), to) end
2067
+
2068
+ H.cuberoot = function(x) return math.pow(x, 0.333333) end
2069
+
2070
+ H.dist_period = function(x, y, period)
2071
+ period = period or 360
2072
+ local d = math.abs((x % period) - (y % period))
2073
+ return math.min(d, period - d)
2074
+ end
2075
+
2076
+ H.get_closest = function(x, values, dist_fun)
2077
+ local best_val, best_key, best_dist = nil, nil, math.huge
2078
+ for key, val in pairs(values) do
2079
+ local cur_dist = dist_fun(x, val)
2080
+ if cur_dist <= best_dist then
2081
+ best_val, best_key, best_dist = val, key, cur_dist
2082
+ end
2083
+ end
2084
+
2085
+ return best_val, best_key
2086
+ end
2087
+
2088
+ return MiniHues