├── LICENSE ├── README.md ├── assets ├── dark.png └── light.png ├── colors └── one-nvim.vim └── lua └── one-nvim.lua /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 David Karrick 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # One Neovim Theme 2 | 3 | An Atom One inspired dark and light colorscheme for neovim. Plugin modeled after [highlite.vim](https://github.com/Iron-E/nvim-highlite/blob/master/colors/highlite.vim) template 4 | 5 | ## Screenshots 6 | 7 | Dark theme 8 | 9 | ![dark theme](assets/dark.png) 10 | 11 | Light theme 12 | 13 | ![light theme](assets/light.png) 14 | 15 | *Font:* Jet Brains Mono 16 | *Statusline:* [Spaceline](https://github.com/glepnir/spaceline.vim) 17 | *RGB Highlightin:* [nvim-colorizer.](https://github.com/norcalli/nvim-colorizer.lua) 18 | *Minimap* [minimap.vim](https://github.com/wfxr/minimap.vim) 19 | 20 | ## Prerequisites 21 | 22 | 1. Neovim 0.5+ 23 | 24 | ### Installation 25 | 26 | #### Vim Plug 27 | 28 | ```vim 29 | Plug 'Th3Whit3Wolf/one-nvim' 30 | 31 | " And then somewhere in your init.vim, to set the colorscheme 32 | colorscheme one-nvim 33 | ``` 34 | 35 | #### Minpac 36 | 37 | ```vim 38 | call minpac#add('Th3Whit3Wolf/one-nvim') 39 | 40 | " And then somewhere in your init.vim, to set the colorscheme 41 | colorscheme one-nvim 42 | ``` 43 | 44 | #### Vim Packages 45 | 46 | In the terminal execute this command. 47 | 48 | ```sh 49 | cd ~/.local/share/nvim/site/pack/opt/ 50 | git clone https://github.com/Th3Whit3Wolf/one-nvim 51 | ``` 52 | 53 | In your `init.vim` add the following 54 | 55 | ```vim 56 | packadd! one-nvim 57 | ``` 58 | 59 | ```vim 60 | colorscheme one-nvim 61 | ``` 62 | 63 | ### Transparent background 64 | ###### Require terminal with transparent background 65 | 66 | ```lua 67 | vim.g.one_nvim_transparent_bg = true 68 | ``` 69 | 70 | ### NOTE 71 | 72 | - Vim is not supported because the theme is written in lua. 73 | - If you feel like a language should be highlighted differently please open an issue. 74 | -------------------------------------------------------------------------------- /assets/dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Th3Whit3Wolf/one-nvim/faf6fb3f98fccbe009c3466f657a8fff84a5f956/assets/dark.png -------------------------------------------------------------------------------- /assets/light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Th3Whit3Wolf/one-nvim/faf6fb3f98fccbe009c3466f657a8fff84a5f956/assets/light.png -------------------------------------------------------------------------------- /colors/one-nvim.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | vim.g.colors_name = "one-nvim" 3 | 4 | if vim.o.background == "dark" then 5 | --[[ 6 | Dark Colors 7 | @syntax-hue: 220; 8 | @syntax-saturation: 13%; 9 | @syntax-brightness: 18%; 10 | @syntax-fg: @mono-1; 11 | @syntax-gutter-background-color-selected: lighten(@syntax-bg, 8%); 12 | for color in $(cat colors/one-nvim.vim | head -n 41 | tail -n 28 | cut -d '#' -f2 | cut -d '"' -f1); do hex2xterm $color | grep 'Hexadecimal\|xterm256'; done 13 | --]] 14 | mono_1 = {"#abb2bf", 145, "mono_1"} -- hsl(@syntax-hue, 14%, 71%); 15 | mono_2 = {"#828997", 102, "mono_2"} -- hsl(@syntax-hue, 9%, 55%); 16 | mono_3 = {"#5c6370", 59, "mono_3"} -- hsl(@syntax-hue, 10%, 40%); 17 | mono_4 = {"#4b5263", 240, "mono_4"} -- 18 | hue_1 = {"#56b6c2", 247, "hue_1"} -- hsl(187, 47%, 55%); 19 | hue_2 = {"#61afef", 75, "hue_2"} -- hsl(207, 82%, 66%); 20 | hue_3 = {"#c678dd", 176, "hue_3"} -- hsl(286, 60%, 67%); 21 | hue_4 = {"#98c379", 114, "hue_4"} -- hsl( 95, 38%, 62%); 22 | hue_5 = {"#e06c75", 168, "hue_5"} -- hsl(355, 65%, 65%); 23 | hue_5_2 = {"#be5046", 131, "hue_5_2"} -- hsl( 5, 48%, 51%); 24 | hue_6 = {"#d19a66", 247, "hue_6"} -- hsl( 29, 54%, 61%); 25 | hue_6_2 = {"#e5c07b", 180, "hue_6_2"} -- hsl( 39, 67%, 69%); 26 | syntax_bg = {"#282c34", 17, "syntax_bg"} -- hsl(@syntax-hue, @syntax-saturation, @syntax-brightness); 27 | syntax_gutter = {"#636d83", 241, "syntax_gutter"} -- darken(@syntax-fg, 26%); 28 | syntax_cursor = {"#2c323c", 23, "syntax_cursor"} 29 | syntax_accent = {"#528bff", 69, "syntax_accent"} -- hsl(@syntax-hue, 100%, 66% ); 30 | vertsplit = {"#181a1f", 234, "vertsplit"} 31 | special_grey = {"#3b4048", 238, "special_grey"} 32 | visual_grey = {"#3e4452", 59, "visual_grey"} 33 | pmenu = {"#333841", 59, "pmenu"} 34 | term_black = {"#282c34", 17, "term_black"} 35 | term_blue = {"#61afef", 75, "term_blue"} 36 | term_cyan = {"#56b6c2", 247, "term_cyan"} 37 | term_white = {"#dcdfe4", 188, "term_white"} 38 | term_8 = {"#5d677a", 242, "term_8"} 39 | syntax_color_added = {"#43d08a", 78, "syntax_color_added"} -- hsl(150, 60%, 54%); 40 | syntax_color_modified = {"#e0c285", 250, "syntax_color_modified"} -- hsl(40, 60%, 70%); 41 | syntax_color_removed = {"#e05252", 244, "syntax_color_removed"} -- hsl(0, 70%, 60%); 42 | else 43 | --[[ 44 | Light Colors 45 | @syntax-hue: 230; 46 | @syntax-saturation: 1%; 47 | @syntax-brightness: 98%; 48 | @syntax-fg: @mono-1; 49 | @syntax-gutter-background-color-selected: darken(@syntax-bg, 8%); 50 | for color in $(cat colors/one-nvim.vim | head -n 79 | tail -n 28 | cut -d '#' -f2 | cut -d '"' -f1); do hex2xterm $color | grep 'Hexadecimal\|xterm256'; done 51 | --]] 52 | mono_1 = {"#383A42", 59, "mono_1"} -- hsl(@syntax-hue, 8%, 24%); 53 | mono_2 = {"#696c77", 60, "mono_2"} -- hsl(@syntax-hue, 6%, 44%); 54 | mono_3 = {"#a0a1a7", 247, "mono_3"} -- hsl(@syntax-hue, 4%, 64%); 55 | mono_4 = {"#c2c2c3", 251, "mono_4"} -- 56 | hue_1 = {"#0184bc", 31, "hue_1"} -- hsl(198, 99%, 37%); 57 | hue_2 = {"#4078f2", 69, "hue_2"} -- hsl(221, 87%, 60%); 58 | hue_3 = {"#a626a4", 243, "hue_3"} -- hsl(301, 63%, 40%); 59 | hue_4 = {"#50a14f", 242, "hue_4"} -- hsl(119, 34%, 47%); 60 | hue_5 = {"#e45649", 244, "hue_5"} -- hsl( 5, 74%, 59%); 61 | hue_5_2 = {"#ca1243", 241, "hue_5_2"} -- hsl(344, 84%, 43%); 62 | hue_6 = {"#986801", 94, "hue_6"} -- hsl(41, 99%, 30%); 63 | hue_6_2 = {"#c18401", 242, "hue_6_2"} -- hsl(41, 99%, 38%) 64 | syntax_bg = {"#fafafa", 231, "syntax_bg"} -- hsl(@syntax-hue, @syntax-saturation, @syntax-brightness); 65 | syntax_gutter = {"#9e9e9e", 247, "syntax_gutter"} -- darken(@syntax-bg, 36%); 66 | syntax_cursor = {"#f0f0f0", 255, "syntax_cursor"} 67 | syntax_accent = {"#526fff", 246, "syntax_accent"} -- hsl(@syntax-hue, 100%, 66% ); 68 | vertsplit = {"#e7e9e1", 254, "vertsplit"} 69 | special_grey = {"#d3d3d3", 252, "special_grey"} 70 | visual_grey = {"#d0d0d0", 252, "visual_grey"} 71 | pmenu = {"#dfdfdf", 254, "pmenu"} 72 | term_black = {"#383a42", 237, "term_black"} 73 | term_blue = {"#0184bc", 31, "term_blue"} 74 | term_cyan = {"#0997b3", 243, "term_cyan"} 75 | term_white = {"#fafafa", 231, "term_white"} 76 | term_8 = {"#4f525e", 240, "term_8"} 77 | syntax_color_added = {"#2db448", 65, "syntax_color_added"} -- hsl(132, 60%, 44%); 78 | syntax_color_modified = {"#f2a60d", 137, "syntax_color_modified"} -- hsl(40, 90%, 50%); 79 | syntax_color_removed = {"#ff1414", 88, "syntax_color_removed"} -- hsl(0, 100%, 54%); 80 | end 81 | 82 | -- Common 83 | local pink = {"#d291e4", 251, "pink"} 84 | syntax_color_renamed = {"#33a0ff", 75, "syntax_color_renamed"} -- hsl(208, 100%, 60%); 85 | 86 | -- Vim Primary Colors 87 | --[[ 88 | Mentioned here https://github.com/Th3Whit3Wolf/onebuddy/pull/7 89 | vim-startify and maybe more plugins rely on these colors 90 | --]] 91 | Red = {"#e88388", 174, "Red"} 92 | DarkRed = {"#e06c75", 168, "DarkRed"} 93 | Blue = {"#61afef", 75, "Blue"} 94 | DarkBlue = {"#528bff", 69, "DarkBlue"} 95 | Green = {"#98c379", 114, "Green"} 96 | DarkGreen = {"#50a14f", 242, "DarkGreen"} 97 | Orange = {"#d19a66", 247, "Orange"} 98 | DarkOrange = {"#c18401", 232, "DarkOrange"} 99 | Yellow = {"#e5c07b", 180, "Yellow"} 100 | DarkYellow = {"#986801", 94, "DarkYellow"} 101 | Purple = {"#a626a4", 243, "Purple"} 102 | Violet = {"#b294bb", 139, "Violet"} 103 | Magenta = {"#ff80ff", 213, "Magenta"} 104 | DarkMagenta = {"#a626a4", 243, "DarkMagenta"} 105 | Black = {"#333841", 59 , "Black"} 106 | Grey = {"#636d83", 243, "Grey"} 107 | White = {"#f2e5bc", 223, "White"} 108 | Cyan = {"#8abeb7", 109, "Cyan"} 109 | DarkCyan = {"#80a0ff", 111, "DarkCyan"} 110 | Aqua = {"#8ec07c", 108, "Aqua"} 111 | 112 | --[[ DO NOT EDIT `BG` NOR `FG`. ]] 113 | local BG = "bg" 114 | local FG = "fg" 115 | local NONE = {} 116 | 117 | --[[ These are the ones you should edit. ]] 118 | -- This is the only highlight that must be defined separately. 119 | local highlight_group_normal = {fg = mono_1, bg = syntax_bg} 120 | 121 | local normal = (function() 122 | if vim.g.one_nvim_transparent_bg ~= true then 123 | return { fg = mono_1, bg = syntax_bg } 124 | else 125 | return { fg = mono_1, bg = NONE } 126 | end 127 | end)() 128 | 129 | -- This is where the rest of your highlights should go. 130 | local highlight_groups = { 131 | ------------------------------------------------------------- 132 | -- Syntax Groups (descriptions and ordering from `:h w18`) -- 133 | ------------------------------------------------------------- 134 | Normal = normal, 135 | NormalFloat = normal, 136 | bold = { style = 'bold'}, 137 | ColorColumn = { fg = none, bg = syntax_cursor }, 138 | Conceal = { fg = mono_4, bg = syntax_bg }, 139 | Cursor = { fg = none, bg = syntax_accent }, 140 | CursorIM = { fg = none}, 141 | CursorColumn = { fg = none, bg = syntax_cursor }, 142 | CursorLine = { fg = none, bg = syntax_cursor }, 143 | Directory = { fg = hue_2 }, 144 | ErrorMsg = { fg = hue_5, bg = syntax_bg }, 145 | VertSplit = { fg = vertsplit }, 146 | FloatBorder = { fg = mono_1, bg = none}, 147 | Folded = { fg = mono_3, bg = syntax_bg }, 148 | FoldColumn = { fg = mono_3, bg = syntax_cursor }, 149 | IncSearch = { fg = hue_6, bg = mono_3 }, 150 | LineNr = { fg = mono_4 }, 151 | CursorLineNr = { fg = mono_1, bg = syntax_cursor }, 152 | MatchParen = { fg = hue_5, bg = syntax_cursor, style = 'underline,bold' }, 153 | Italic = { fg = none, style = 'italic'}, 154 | ModeMsg = { fg = mono_1 }, 155 | MoreMsg = { fg = mono_1 }, 156 | NonText = { fg = mono_3 }, 157 | PMenu = { fg = none, bg = pmenu }, 158 | PMenuSel = { fg = none, bg = mono_4 }, 159 | PMenuSbar = { fg = none, bg = syntax_bg }, 160 | PMenuThumb = { fg = none, bg = mono_1 }, 161 | Question = { fg = hue_2 }, 162 | Search = { fg = syntax_bg, bg = hue_6_2 }, 163 | SpecialKey = { fg = special_grey}, 164 | Whitespace = { fg = special_grey}, 165 | StatusLine = { fg = mono_1, bg = syntax_cursor }, 166 | StatusLineNC = { fg = mono_3 }, 167 | TabLine = { fg = mono_2, bg = visual_grey}, 168 | TabLineFill = { fg = mono_3, bg = visual_grey}, 169 | TabLineSel = { fg = syntax_bg, bg = hue_2 }, 170 | Title = { fg = mono_1, bg = none, style = 'bold'}, 171 | Visual = { fg = none, bg = visual_grey}, 172 | VisualNOS = { fg = none, bg = visual_grey}, 173 | WarningMsg = { fg = hue_5 }, 174 | TooLong = { fg = hue_5 }, 175 | WildMenu = { fg = mono_1, bg = mono_3 }, 176 | SignColumn = { fg = none, bg = syntax_bg }, 177 | Special = { fg = hue_2 }, 178 | 179 | --------------------------- 180 | -- Vim Help Highlighting -- 181 | --------------------------- 182 | 183 | helpCommand = { fg = hue_6_2 }, 184 | helpExample = { fg = hue_6_2 }, 185 | helpHeader = { fg = mono_1, style = 'bold'}, 186 | helpSectionDelim = { fg = mono_3,}, 187 | 188 | ---------------------------------- 189 | -- Standard Syntax Highlighting -- 190 | ---------------------------------- 191 | 192 | Comment = { fg = mono_3, style = 'italic'}, 193 | Constant = { fg = hue_4, bg = none}, 194 | String = { fg = hue_4, bg = none}, 195 | Character = { fg = hue_4, bg = none}, 196 | Number = { fg = hue_6, bg = none}, 197 | Boolean = { fg = hue_6, bg = none}, 198 | Float = { fg = hue_6, bg = none}, 199 | Identifier = { fg = hue_5, bg = none}, 200 | Function = { fg = hue_2, bg = none}, 201 | Statement = { fg = hue_3, bg = none}, 202 | Conditional = { fg = hue_3, bg = none}, 203 | Repeat = { fg = hue_3, bg = none}, 204 | Label = { fg = hue_3, bg = none}, 205 | Operator = { fg = syntax_accent }, 206 | Keyword = { fg = hue_5, bg = none}, 207 | Exception = { fg = hue_3, bg = none}, 208 | PreProc = { fg = hue_6_2, bg = none}, 209 | Include = { fg = hue_2, bg = none}, 210 | Define = { fg = hue_3, bg = none}, 211 | Macro = { fg = hue_3, bg = none}, 212 | PreCondit = { fg = hue_6_2, bg = none}, 213 | Type = { fg = hue_6_2, bg = none}, 214 | StorageClass = { fg = hue_6_2, bg = none}, 215 | Structure = { fg = hue_6_2, bg = none}, 216 | Typedef = { fg = hue_6_2, bg = none}, 217 | Special = { fg = hue_2, bg = none}, 218 | SpecialChar = { fg = none}, 219 | Tag = { fg = none}, 220 | Delimiter = { fg = none}, 221 | SpecialComment = { fg = none}, 222 | Debug = { fg = none}, 223 | Underlined = { fg = none, style = 'underline' }, 224 | Ignore = { fg = none}, 225 | Error = { fg = hue_5, bg = mono_3, style = 'bold'}, 226 | Todo = { fg = hue_3, bg = mono_3 }, 227 | 228 | ----------------------- 229 | -- Diff Highlighting -- 230 | ----------------------- 231 | 232 | DiffAdd = { fg = syntax_color_added, bg = visual_grey}, 233 | DiffChange = { fg = syntax_color_modified, bg = visual_grey}, 234 | DiffDelete = { fg = syntax_color_removed, bg = visual_grey}, 235 | DiffText = { fg = hue_2, bg = visual_grey}, 236 | DiffAdded = { fg = hue_4, bg = visual_grey}, 237 | DiffFile = { fg = hue_5, bg = visual_grey}, 238 | DiffNewFile = { fg = hue_4, bg = visual_grey}, 239 | DiffLine = { fg = hue_2, bg = visual_grey}, 240 | DiffRemoved = { fg = hue_5, bg = visual_grey}, 241 | 242 | --------------------------- 243 | -- Filetype Highlighting -- 244 | --------------------------- 245 | 246 | -- Asciidoc 247 | asciidocListingBlock = { fg = mono_2 }, 248 | 249 | -- C/C++ highlighting 250 | cInclude = { fg = hue_3 }, 251 | cPreCondit = { fg = hue_3 }, 252 | cPreConditMatch = { fg = hue_3 }, 253 | cType = { fg = hue_3 }, 254 | cStorageClass = { fg = hue_3 }, 255 | cStructure = { fg = hue_3 }, 256 | cOperator = { fg = hue_3 }, 257 | cStatement = { fg = hue_3 }, 258 | cTODO = { fg = hue_3 }, 259 | cConstant = { fg = hue_6 }, 260 | cSpecial = { fg = hue_1 }, 261 | cSpecialCharacter = { fg = hue_1 }, 262 | cString = { fg = hue_4 }, 263 | cppType = { fg = hue_3 }, 264 | cppStorageClass = { fg = hue_3 }, 265 | cppStructure = { fg = hue_3 }, 266 | cppModifier = { fg = hue_3 }, 267 | cppOperator = { fg = hue_3 }, 268 | cppAccess = { fg = hue_3 }, 269 | cppStatement = { fg = hue_3 }, 270 | cppConstant = { fg = hue_5 }, 271 | cCppString = { fg = hue_4 }, 272 | 273 | -- Cucumber 274 | cucumberGiven = { fg = hue_2 }, 275 | cucumberWhen = { fg = hue_2 }, 276 | cucumberWhenAnd = { fg = hue_2 }, 277 | cucumberThen = { fg = hue_2 }, 278 | cucumberThenAnd = { fg = hue_2 }, 279 | cucumberUnparsed = { fg = hue_6 }, 280 | cucumberFeature = { fg = hue_5, style = 'bold'}, 281 | cucumberBackground = { fg = hue_3, style = 'bold'}, 282 | cucumberScenario = { fg = hue_3, style = 'bold'}, 283 | cucumberScenarioOutline = { fg = hue_3, style = 'bold'}, 284 | cucumberTags = { fg = mono_3, style = 'bold'}, 285 | cucumberDelimiter = { fg = mono_3, style = 'bold'}, 286 | 287 | -- CSS/Sass 288 | cssAttrComma = { fg = hue_3 }, 289 | cssAttributeSelector = { fg = hue_4 }, 290 | cssBraces = { fg = mono_2 }, 291 | cssClassName = { fg = hue_6 }, 292 | cssClassNameDot = { fg = hue_6 }, 293 | cssDefinition = { fg = hue_3 }, 294 | cssFontAttr = { fg = hue_6 }, 295 | cssFontDescriptor = { fg = hue_3 }, 296 | cssFunctionName = { fg = hue_2 }, 297 | cssIdentifier = { fg = hue_2 }, 298 | cssImportant = { fg = hue_3 }, 299 | cssInclude = { fg = mono_1 }, 300 | cssIncludeKeyword = { fg = hue_3 }, 301 | cssMediaType = { fg = hue_6 }, 302 | cssProp = { fg = hue_1 }, 303 | cssPseudoClassId = { fg = hue_6 }, 304 | cssSelectorOp = { fg = hue_3 }, 305 | cssSelectorOp2 = { fg = hue_3 }, 306 | cssStringQ = { fg = hue_4 }, 307 | cssStringQQ = { fg = hue_4 }, 308 | cssTagName = { fg = hue_5 }, 309 | cssAttr = { fg = hue_6 }, 310 | sassAmpersand = { fg = hue_5 }, 311 | sassClass = { fg = hue_6_2 }, 312 | sassControl = { fg = hue_3 }, 313 | sassExtend = { fg = hue_3 }, 314 | sassFor = { fg = mono_1 }, 315 | sassProperty = { fg = hue_1 }, 316 | sassFunction = { fg = hue_1 }, 317 | sassId = { fg = hue_2 }, 318 | sassInclude = { fg = hue_3 }, 319 | sassMedia = { fg = hue_3 }, 320 | sassMediaOperators = { fg = mono_1 }, 321 | sassMixin = { fg = hue_3 }, 322 | sassMixinName = { fg = hue_2 }, 323 | sassMixing = { fg = hue_3 }, 324 | scssSelectorName = { fg = hue_6_2 }, 325 | 326 | -- Elixir highlighting 327 | elixirModuleDefine = 'Define', 328 | elixirAlias = { fg = hue_6_2 }, 329 | elixirAtom = { fg = hue_1 }, 330 | elixirBlockDefinition = { fg = hue_3 }, 331 | elixirModuleDeclaration = { fg = hue_6 }, 332 | elixirInclude = { fg = hue_5 }, 333 | elixirOperator = { fg = hue_6 }, 334 | 335 | -- Git and git related plugins 336 | gitcommitComment = { fg = mono_3 }, 337 | gitcommitUnmerged = { fg = hue_4 }, 338 | gitcommitOnBranch = { fg = none}, 339 | gitcommitBranch = { fg = hue_3 }, 340 | gitcommitDiscardedType = { fg = hue_5 }, 341 | gitcommitSelectedType = { fg = hue_4 }, 342 | gitcommitHeader = { fg = none}, 343 | gitcommitUntrackedFile = { fg = hue_1 }, 344 | gitcommitDiscardedFile = { fg = hue_5 }, 345 | gitcommitSelectedFile = { fg = hue_4 }, 346 | gitcommitUnmergedFile = { fg = hue_6_2 }, 347 | gitcommitFile = { fg = none}, 348 | gitcommitNoBranch = 'gitcommitBranch', 349 | gitcommitUntracked = 'gitcommitComment', 350 | gitcommitDiscarded = 'gitcommitComment', 351 | gitcommitDiscardedArrow = 'gitcommitDiscardedFile', 352 | gitcommitSelectedArrow = 'gitcommitSelectedFile', 353 | gitcommitUnmergedArrow = 'gitcommitUnmergedFile', 354 | SignifySignAdd = { fg = syntax_color_added }, 355 | SignifySignChange = { fg = syntax_color_modified }, 356 | SignifySignDelete = { fg = syntax_color_removed }, 357 | GitGutterAdd = 'SignifySignAdd', 358 | GitGutterChange = 'SignifySignChange', 359 | GitGutterDelete = 'SignifySignDelete', 360 | GitSignsAdd = 'SignifySignAdd', 361 | GitSignsChange = 'SignifySignChange', 362 | GitSignsDelete = 'SignifySignDelete', 363 | 364 | -- Go 365 | goDeclaration = { fg = hue_3 }, 366 | goField = { fg = hue_5 }, 367 | goMethod = { fg = hue_1 }, 368 | goType = { fg = hue_3 }, 369 | goUnsignedInts = { fg = hue_1 }, 370 | 371 | -- Haskell highlighting 372 | haskellDeclKeyword = { fg = hue_2 }, 373 | haskellType = { fg = hue_4 }, 374 | haskellWhere = { fg = hue_5 }, 375 | haskellImportKeywords = { fg = hue_2 }, 376 | haskellOperators = { fg = hue_5 }, 377 | haskellDelimiter = { fg = hue_2 }, 378 | haskellIdentifier = { fg = hue_6 }, 379 | haskellKeyword = { fg = hue_5 }, 380 | haskellNumber = { fg = hue_1 }, 381 | haskellString = { fg = hue_1 }, 382 | 383 | -- HTML 384 | htmlArg = { fg = hue_6 }, 385 | htmlTagName = { fg = hue_5 }, 386 | htmlTagN = { fg = hue_5 }, 387 | htmlSpecialTagName = { fg = hue_5 }, 388 | htmlTag = { fg = mono_2 }, 389 | htmlEndTag = { fg = mono_2 }, 390 | MatchTag = { fg = hue_5, bg = syntax_cursor, style = 'bold,underline'}, 391 | 392 | -- JavaScript 393 | coffeeString = { fg = hue_4 }, 394 | javaScriptBraces = { fg = mono_2 }, 395 | javaScriptFunction = { fg = hue_3 }, 396 | javaScriptIdentifier = { fg = hue_3 }, 397 | javaScriptNull = { fg = hue_6 }, 398 | javaScriptNumber = { fg = hue_6 }, 399 | javaScriptRequire = { fg = hue_1 }, 400 | javaScriptReserved = { fg = hue_3 }, 401 | -- httpc.//github.com/pangloss/vim-javascript 402 | jsArrowFunction = { fg = hue_3 }, 403 | jsBraces = { fg = mono_2 }, 404 | jsClassBraces = { fg = mono_2 }, 405 | jsClassKeywords = { fg = hue_3 }, 406 | jsDocParam = { fg = hue_2 }, 407 | jsDocTags = { fg = hue_3 }, 408 | jsFuncBraces = { fg = mono_2 }, 409 | jsFuncCall = { fg = hue_2 }, 410 | jsFuncParens = { fg = mono_2 }, 411 | jsFunction = { fg = hue_3 }, 412 | jsGlobalObjects = { fg = hue_6_2 }, 413 | jsModuleWords = { fg = hue_3 }, 414 | jsModules = { fg = hue_3 }, 415 | jsNoise = { fg = mono_2 }, 416 | jsNull = { fg = hue_6 }, 417 | jsOperator = { fg = hue_3 }, 418 | jsParens = { fg = mono_2 }, 419 | jsStorageClass = { fg = hue_3 }, 420 | jsTemplateBraces = { fg = hue_5_2 }, 421 | jsTemplateVar = { fg = hue_4 }, 422 | jsThis = { fg = hue_5 }, 423 | jsUndefined = { fg = hue_6 }, 424 | jsObjectValue = { fg = hue_2 }, 425 | jsObjectKey = { fg = hue_1 }, 426 | jsReturn = { fg = hue_3 }, 427 | -- httpc.//github.com/othree/yajs.vim 428 | javascriptArrowFunc = { fg = hue_3 }, 429 | javascriptClassExtends = { fg = hue_3 }, 430 | javascriptClassKeyword = { fg = hue_3 }, 431 | javascriptDocNotation = { fg = hue_3 }, 432 | javascriptDocParamName = { fg = hue_2 }, 433 | javascriptDocTags = { fg = hue_3 }, 434 | javascriptEndColons = { fg = mono_3 }, 435 | javascriptExport = { fg = hue_3 }, 436 | javascriptFuncArg = { fg = mono_1 }, 437 | javascriptFuncKeyword = { fg = hue_3 }, 438 | javascriptIdentifier = { fg = hue_5 }, 439 | javascriptImport = { fg = hue_3 }, 440 | javascriptObjectLabel = { fg = mono_1 }, 441 | javascriptOpSymbol = { fg = hue_1 }, 442 | javascriptOpSymbols = { fg = hue_1 }, 443 | javascriptPropertyName = { fg = hue_4 }, 444 | javascriptTemplateSB = { fg = hue_5_2 }, 445 | javascriptVariable = { fg = hue_3 }, 446 | 447 | -- JSON 448 | jsonCommentError = { fg = mono_1 }, 449 | jsonKeyword = { fg = hue_5 }, 450 | jsonQuote = { fg = mono_3 }, 451 | jsonTrailingCommaError = { fg = hue_5, style = 'reverse' }, 452 | jsonMissingCommaError = { fg = hue_5, style = 'reverse' }, 453 | jsonNoQuotesError = { fg = hue_5, style = 'reverse' }, 454 | jsonNumError = { fg = hue_5, style = 'reverse' }, 455 | jsonString = { fg = hue_4 }, 456 | jsonBoolean = { fg = hue_3 }, 457 | jsonNumber = { fg = hue_6 }, 458 | jsonStringSQError = { fg = hue_5, style = 'reverse' }, 459 | jsonSemicolonError = { fg = hue_5, style = 'reverse' }, 460 | 461 | -- Markdown 462 | markdownUrl = { fg = mono_3, stlye = 'underline' }, 463 | markdownBold = { fg = hue_6, style = 'bold' }, 464 | markdownItalic = { fg = hue_6, style = 'italic' }, 465 | markdownCode = { fg = hue_4 }, 466 | markdownCodeBlock = { fg = hue_5 }, 467 | markdownCodeDelimiter = { fg = hue_4 }, 468 | markdownHeadingDelimiter = { fg = hue_5_2 }, 469 | markdownH1 = { fg = hue_5 }, 470 | markdownH2 = { fg = hue_5 }, 471 | markdownH3 = { fg = hue_5 }, 472 | markdownH3 = { fg = hue_5 }, 473 | markdownH4 = { fg = hue_5 }, 474 | markdownH5 = { fg = hue_5 }, 475 | markdownH6 = { fg = hue_5 }, 476 | markdownListMarker = { fg = hue_5 }, 477 | 478 | -- PHP 479 | phpClass = { fg = hue_6_2 }, 480 | phpFunction = { fg = hue_2 }, 481 | phpFunctions = { fg = hue_2 }, 482 | phpInclude = { fg = hue_3 }, 483 | phpKeyword = { fg = hue_3 }, 484 | phpParent = { fg = mono_3 }, 485 | phpType = { fg = hue_3 }, 486 | phpSuperGlobals = { fg = hue_5 }, 487 | 488 | -- Pug (Formerly Jade) 489 | pugAttributesDelimiter = { fg = hue_6 }, 490 | pugClass = { fg = hue_6 }, 491 | pugDocType = { fg = mono_3, style = 'italic'}, 492 | pugTag = { fg = hue_5 }, 493 | 494 | -- PureScript 495 | purescriptKeyword = { fg = hue_3 }, 496 | purescriptModuleName = { fg = mono_1 }, 497 | purescriptIdentifier = { fg = mono_1 }, 498 | purescriptType = { fg = hue_6_2 }, 499 | purescriptTypeVar = { fg = hue_5 }, 500 | purescriptConstructor = { fg = hue_5 }, 501 | purescriptOperator = { fg = mono_1 }, 502 | 503 | -- Python 504 | pythonImport = { fg = hue_3 }, 505 | pythonBuiltin = { fg = hue_1 }, 506 | pythonStatement = { fg = hue_3 }, 507 | pythonParam = { fg = hue_6 }, 508 | pythonEscape = { fg = hue_5 }, 509 | pythonSelf = { fg = mono_2, style = 'italic'}, 510 | pythonClass = { fg = hue_2 }, 511 | pythonOperator = { fg = hue_3 }, 512 | pythonEscape = { fg = hue_5 }, 513 | pythonFunction = { fg = hue_2 }, 514 | pythonKeyword = { fg = hue_2 }, 515 | pythonModule = { fg = hue_3 }, 516 | pythonStringDelimiter = { fg = hue_4 }, 517 | pythonSymbol = { fg = hue_1 }, 518 | 519 | -- Ruby 520 | rubyBlock = { fg = hue_3 }, 521 | rubyBlockParameter = { fg = hue_5 }, 522 | rubyBlockParameterList = { fg = hue_5 }, 523 | rubyCapitalizedMethod = { fg = hue_3 }, 524 | rubyClass = { fg = hue_3 }, 525 | rubyConstant = { fg = hue_6_2 }, 526 | rubyControl = { fg = hue_3 }, 527 | rubyDefine = { fg = hue_3 }, 528 | rubyEscape = { fg = hue_5 }, 529 | rubyFunction = { fg = hue_2 }, 530 | rubyGlobalVariable = { fg = hue_5 }, 531 | rubyInclude = { fg = hue_2 }, 532 | rubyIncluderubyGlobalVariable = { fg = hue_5 }, 533 | rubyInstanceVariable = { fg = hue_5 }, 534 | rubyInterpolation = { fg = hue_1 }, 535 | rubyInterpolationDelimiter = { fg = hue_5 }, 536 | rubyKeyword = { fg = hue_2 }, 537 | rubyModule = { fg = hue_3 }, 538 | rubyPseudoVariable = { fg = hue_5 }, 539 | rubyRegexp = { fg = hue_1 }, 540 | rubyRegexpDelimiter = { fg = hue_1 }, 541 | rubyStringDelimiter = { fg = hue_4 }, 542 | rubySymbol = { fg = hue_1 }, 543 | 544 | -- Spelling 545 | SpellBad = { fg = mono_3, style = 'undercurl'}, 546 | SpellLocal = { fg = mono_3, style = 'undercurl'}, 547 | SpellCap = { fg = mono_3, style = 'undercurl'}, 548 | SpellRare = { fg = mono_3, style = 'undercurl'}, 549 | 550 | -- Vim 551 | vimCommand = { fg = hue_3 }, 552 | vimCommentTitle = { fg = mono_3, style = 'bold'}, 553 | vimFunction = { fg = hue_1 }, 554 | vimFuncName = { fg = hue_3 }, 555 | vimHighlight = { fg = hue_2 }, 556 | vimLineComment = { fg = mono_3, style = 'italic'}, 557 | vimParenSep = { fg = mono_2 }, 558 | vimSep = { fg = mono_2 }, 559 | vimUserFunc = { fg = hue_1 }, 560 | vimVar = { fg = hue_5 }, 561 | 562 | -- XML 563 | xmlAttrib = { fg = hue_6_2 }, 564 | xmlEndTag = { fg = hue_5 }, 565 | xmlTag = { fg = hue_5 }, 566 | xmlTagName = { fg = hue_5 }, 567 | 568 | -- ZSH 569 | zshCommands = { fg = mono_1 }, 570 | zshDeref = { fg = hue_5 }, 571 | zshShortDeref = { fg = hue_5 }, 572 | zshFunction = { fg = hue_1 }, 573 | zshKeyword = { fg = hue_3 }, 574 | zshSubst = { fg = hue_5 }, 575 | zshSubstDelim = { fg = mono_3 }, 576 | zshTypes = { fg = hue_3 }, 577 | zshVariableDef = { fg = hue_6 }, 578 | 579 | -- Rust 580 | rustExternCrate = { fg = hue_5, style = 'bold'}, 581 | rustIdentifier = { fg = hue_2 }, 582 | rustDeriveTrait = { fg = hue_4 }, 583 | SpecialComment = { fg = mono_3 }, 584 | rustCommentLine = { fg = mono_3 }, 585 | rustCommentLineDoc = { fg = mono_3 }, 586 | rustCommentLineDocError = { fg = mono_3 }, 587 | rustCommentBlock = { fg = mono_3 }, 588 | rustCommentBlockDoc = { fg = mono_3 }, 589 | rustCommentBlockDocError = { fg = mono_3 }, 590 | 591 | -- Man 592 | manTitle = 'String', 593 | manFooter = { fg = mono_3 }, 594 | 595 | ------------------------- 596 | -- Plugin Highlighting -- 597 | ------------------------- 598 | 599 | -- ALE (Asynchronous Lint Engine) 600 | ALEWarningSign = { fg = hue_6_2 }, 601 | ALEErrorSign = { fg = hue_5 }, 602 | 603 | -- Neovim NERDTree Background fix 604 | NERDTreeFile = { fg = mono_1 }, 605 | 606 | -- Coc.nvim 607 | CocFloating = { bg = none }, 608 | NormalFloating = { bg = none }, 609 | 610 | ----------------------------- 611 | -- LSP Highlighting -- 612 | ----------------------------- 613 | 614 | LspDiagnosticsDefaultError = { fg = hue_5 }, 615 | LspDiagnosticsDefaultWarning = { fg = hue_6_2 }, 616 | LspDiagnosticsDefaultInformation = { fg = hue_1 }, 617 | LspDiagnosticsDefaultHint = { fg = hue_4 }, 618 | LspDiagnosticsVirtualTextError = { fg = hue_5 }, 619 | LspDiagnosticsVirtualTextWarning = { fg = hue_6_2 }, 620 | LspDiagnosticsVirtualTextInformation = { fg = hue_1 }, 621 | LspDiagnosticsVirtualTextHint = { fg = hue_4 }, 622 | LspDiagnosticsUnderlineError = { fg = hue_5 , style = 'underline' }, 623 | LspDiagnosticsUnderlineWarning = { fg = hue_6_2 , style = 'underline' }, 624 | LspDiagnosticsUnderlineInformation = { fg = hue_1 , style = 'underline' }, 625 | LspDiagnosticsUnderlineHint = { fg = hue_4 , style = 'underline' }, 626 | LspDiagnosticsFloatingError = { fg = hue_5 , bg = pmenu }, 627 | LspDiagnosticsFloatingWarning = { fg = hue_6_2 , bg = pmenu }, 628 | LspDiagnosticsFloatingInformation = { fg = hue_1 , bg = pmenu }, 629 | LspDiagnosticsFloatingHint = { fg = hue_4 , bg = pmenu }, 630 | LspDiagnosticsSignError = { fg = hue_5 }, 631 | LspDiagnosticsSignWarning = { fg = hue_6_2 }, 632 | LspDiagnosticsSignInformation = { fg = hue_1 }, 633 | LspDiagnosticsSignHint = { fg = hue_4 }, 634 | LspReferenceText = { style = 'reverse' }, 635 | LspReferenceRead = { style = 'reverse' }, 636 | LspReferenceWrite = { fg = hue_6_2, style = 'reverse' }, 637 | 638 | ----------------------------- 639 | -- TreeSitter Highlighting -- 640 | ----------------------------- 641 | 642 | TSAnnotation = 'PreProc', 643 | TSAttribute = 'PreProc', 644 | TSBoolean = 'Boolean', 645 | TSCharacter = 'Character', 646 | TSComment = 'Comment', 647 | TSConditional = 'Conditional', 648 | TSConstant = 'Constant', 649 | TSConstBuiltin = 'Special', 650 | TSConstMacro = 'Define', 651 | TSConstructor = 'Special', 652 | TSEmphasis = 'Italic', 653 | TSError = 'Error', 654 | TSException = 'Exception', 655 | TSField = 'Normal', 656 | TSFloat = 'Float', 657 | TSFunction = 'Function', 658 | TSFuncBuiltin = 'Special', 659 | TSFuncMacro = 'Macro', 660 | TSInclude = 'Include', 661 | TSKeyword = 'Keyword', 662 | TSKeywordFunction = 'Keyword', 663 | TSKeywordOperator = 'Operator', 664 | TSLabel = 'Label', 665 | TSLiteral = 'String', 666 | TSMethod = 'Function', 667 | TSNamespace = 'Include', 668 | TSNumber = 'Number', 669 | TSOperator = 'Operator', 670 | TSParameter = 'Identifier', 671 | TSParameterReference = 'Identifier', 672 | TSProperty = 'Identifier', 673 | TSPunctBracket = 'Delimiter', 674 | TSPunctDelimiter = 'Delimiter', 675 | TSPunctSpecial = 'Delimiter', 676 | TSRepeat = 'Repeat', 677 | TSString = 'String', 678 | TSStringEscape = 'SpecialChar', 679 | TSStringRegex = 'String', 680 | TSStrong = 'bold', 681 | TSTag = 'Label', 682 | TSTagDelimiter = 'Label', 683 | -- TSText = { fg = hue_6_2 }, 684 | TSTitle = 'Title', 685 | TSType = 'Type', 686 | TSTypeBuiltin = 'Type', 687 | TSUnderline = 'Underlined', 688 | TSURI = 'Underlined', 689 | TSVariableBuiltin = 'Special', 690 | 691 | } 692 | 693 | local terminal_ansi_colors = { 694 | [0] = term_black, 695 | [1] = hue_5, 696 | [2] = hue_4, 697 | [3] = hue_6_2, 698 | [4] = term_blue, 699 | [5] = hue_3, 700 | [6] = term_cyan, 701 | [7] = term_white, 702 | [8] = term_8, 703 | [9] = hue_5, 704 | [10] = hue_4, 705 | [11] = hue_6_2, 706 | [12] = term_blue, 707 | [13] = hue_3, 708 | [14] = term_cyan, 709 | [15] = term_white 710 | } 711 | 712 | 713 | require(vim.g.colors_name)(highlight_group_normal, highlight_groups, terminal_ansi_colors) 714 | 715 | -- Thanks to Iron-E (https://github.com/Iron-E) for the template (Iron-E/nvim-highlite). 716 | -- vim: ft=lua 717 | 718 | EOF 719 | -------------------------------------------------------------------------------- /lua/one-nvim.lua: -------------------------------------------------------------------------------- 1 | local vim, api, fn, exe, go = vim, vim.api, vim.fn, vim.api.nvim_command, vim.go 2 | 3 | --[[ VARIABLES ]] 4 | -- These are constants for the indexes in the colors that were defined before. 5 | local _NONE = 'NONE' 6 | local _PALETTE_256 = 2 7 | local _PALETTE_ANSI = 3 8 | local _PALETTE_HEX = 1 9 | local _TYPE_STRING = 'string' 10 | local _TYPE_TABLE = 'table' 11 | 12 | -- Determine which set of colors to use. 13 | local _USE_HEX = go.termguicolors 14 | local _USE_256 = tonumber(go.t_Co) > 255 15 | or string.find(vim.env.TERM, '256') 16 | 17 | --[[ HELPER FUNCTIONS ]] 18 | 19 | -- Add the 'blend' parameter to some highlight command, if there is one. 20 | local function blend(command, attributes) -- {{{ † 21 | if attributes.blend then -- There is a value for the `highlight-blend` field. 22 | command[#command+1]=' blend='..attributes.blend 23 | end 24 | end 25 | 26 | -- filter a highlight group's style information 27 | local function filter_group_style(value) 28 | return value ~= 'background' 29 | and value ~= 'blend' 30 | and value ~= 'foreground' 31 | and value ~= 'special' 32 | end 33 | 34 | -- Get the color value of a color variable, or "NONE" as a default. 35 | local function get(color, index) -- {{{ † 36 | if type(color) == _TYPE_TABLE and color[index] then 37 | return color[index] 38 | elseif type(color) == _TYPE_STRING then 39 | return color 40 | else 41 | return _NONE 42 | end 43 | end 44 | 45 | --[[ If using hex and 256-bit colors, then populate the gui* and cterm* args. 46 | If using 16-bit colors, just populate the cterm* args. ]] 47 | local colorize = _USE_HEX and function(command, attributes) -- {{{ † 48 | command[#command+1]=' guibg='..get(attributes.bg, _PALETTE_HEX)..' guifg='..get(attributes.fg, _PALETTE_HEX) 49 | end or _USE_256 and function(command, attributes) 50 | command[#command+1]=' ctermbg='..get(attributes.bg, _PALETTE_256)..' ctermfg='..get(attributes.fg, _PALETTE_256) 51 | end or function(command, attributes) 52 | command[#command+1]=' ctermbg='..get(attributes.bg, _PALETTE_ANSI)..' ctermfg='..get(attributes.fg, _PALETTE_ANSI) 53 | end 54 | 55 | -- This function appends `selected_attributes` to the end of `highlight_cmd`. 56 | local stylize = _USE_HEX and function(command, style, color) 57 | command[#command+1]=' gui='..style 58 | 59 | if color then -- There is an undercurl color. 60 | command[#command+1]=' guisp='..get(color, _PALETTE_HEX) 61 | end 62 | end or function(command, style) 63 | command[#command+1]=' cterm='..style 64 | end 65 | 66 | local function tohex(rgb) return string.format('#%06x', rgb) end 67 | 68 | -- Load specific &bg instructions 69 | local function use_background_with(attributes) 70 | return setmetatable( 71 | attributes[go.background], 72 | {['__index'] = attributes} 73 | ) 74 | end 75 | 76 | --[[ MODULE ]] 77 | 78 | local highlite = {} 79 | 80 | function highlite.group(group_name) 81 | local no_errors, group_definition = pcall(api.nvim_get_hl_by_name, group_name, go.termguicolors) 82 | 83 | if not no_errors then group_definition = {} end 84 | 85 | -- the style of the highlight group 86 | local style = vim.tbl_filter(filter_group_style, vim.tbl_keys(group_definition)) 87 | if group_definition.special then 88 | style.color = tohex(group_definition.special) 89 | end 90 | 91 | return { 92 | ['fg'] = group_definition.foreground and tohex(group_definition.foreground) or _NONE, 93 | ['bg'] = group_definition.background and tohex(group_definition.background) or _NONE, 94 | ['blend'] = group_definition.blend, 95 | ['style'] = style or _NONE 96 | } 97 | end 98 | 99 | -- Generate a `:highlight` command from a group and some attributes. 100 | function highlite.highlight(highlight_group, attributes) -- {{{ † 101 | -- The base highlight command 102 | local highlight_cmd = {'hi! ', highlight_group} 103 | 104 | if type(attributes) == _TYPE_STRING then -- `highlight_group` is a link to another group. 105 | highlight_cmd[3] = highlight_cmd[2] 106 | highlight_cmd[2] = 'link ' 107 | highlight_cmd[4] = ' ' 108 | highlight_cmd[5] = attributes 109 | else -- The `highlight_group` is uniquely defined. 110 | -- Take care of special instructions for certain background colors. 111 | if attributes[go.background] then 112 | attributes = use_background_with(attributes) 113 | end 114 | 115 | colorize(highlight_cmd, attributes) 116 | blend(highlight_cmd, attributes) 117 | 118 | local style = attributes.style or _NONE 119 | 120 | if type(style) == _TYPE_TABLE then 121 | -- Concat all of the entries together with a comma between before styling. 122 | stylize(highlight_cmd, table.concat(style, ','), style.color) 123 | else -- The style is just a single entry. 124 | stylize(highlight_cmd, style) 125 | end 126 | end 127 | 128 | exe(table.concat(highlight_cmd)) 129 | end 130 | 131 | function highlite:highlight_terminal(terminal_ansi_colors) 132 | for index, color in ipairs(terminal_ansi_colors) do 133 | vim.g['terminal_color_'..index] = go.termguicolors and color[_PALETTE_HEX] or color[_PALETTE_256] or get(color, _PALETTE_ANSI) 134 | end 135 | end 136 | 137 | return setmetatable(highlite, { 138 | ['__call'] = function(self, normal, highlights, terminal_ansi_colors) 139 | -- function to resolve function highlight groups being defined by function calls. 140 | local function resolve(tbl, key, resolve_links) 141 | local value = tbl[key] 142 | local value_type = type(value) 143 | if value_type == 'function' then 144 | -- lazily cache the result; next time, if it isn't a function this step will be skipped 145 | tbl[key] = value(setmetatable({}, { 146 | ['__index'] = function(_, inner_key) return resolve(tbl, inner_key, true) end 147 | })) 148 | elseif value_type == _TYPE_STRING and not string.find(value, '^#') and resolve_links then 149 | return resolve(tbl, tbl[key], resolve_links) 150 | end 151 | 152 | return tbl[key] 153 | end 154 | 155 | 156 | -- save the colors_name before syntax reset 157 | local color_name = vim.g.colors_name 158 | 159 | -- Clear the highlighting. 160 | exe 'hi clear' 161 | 162 | -- If the syntax has been enabled, reset it. 163 | if fn.exists 'syntax_on' then exe 'syntax reset' end 164 | 165 | -- replace the colors_name 166 | vim.g.colors_name = color_name 167 | color_name = nil 168 | 169 | -- If we aren't using hex nor 256 colorsets. 170 | if not (_USE_HEX or _USE_256) then go.t_Co = '16' end 171 | 172 | -- Highlight the baseline. 173 | self.highlight('Normal', normal) 174 | 175 | -- Highlight everything else. 176 | for highlight_group, _ in pairs(highlights) do 177 | self.highlight(highlight_group, resolve(highlights, highlight_group, false)) 178 | end 179 | 180 | -- Set the terminal highlight colors. 181 | self:highlight_terminal(terminal_ansi_colors) 182 | end 183 | }) 184 | --------------------------------------------------------------------------------