├── .gitignore ├── LICENSE ├── Makefile ├── README.md └── colors └── rnb.erb /.gitignore: -------------------------------------------------------------------------------- 1 | rnb.vim 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Romain Lafourcade 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 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ####### ## ## ####### 2 | ## ## ### ## ## ## 3 | ## ## #### ## ## ## 4 | ####### ## ## ## ####### 5 | ## ## ## #### ## ## 6 | ## ## ## ### ## ## 7 | ## ## ## ## ####### 8 | 9 | VIM_OUTPUTS = $(patsubst %.erb,%.vim,$(wildcard colors/*.erb)) 10 | 11 | .PHONY: all 12 | 13 | all: $(VIM_OUTPUTS) 14 | 15 | %.vim: %.erb 16 | erb -T - $< > $@ 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vim-RNB, a Vim colorscheme template 2 | 3 | ## What is this thing? 4 | 5 | RNB is a template designed to help vimmers create their own colorschemes without much effort. 6 | 7 | In reality, Vim colorschemes are not that hard to write but there are several benefits to using a template such as RNB: 8 | 9 | * you can define/modify variables once instead of messing around with potentially botched substitutions, 10 | * you can distribute a lean colorscheme, free from unnecessary logic, 11 | * you can distribute the source alongside the colorscheme, making it easy for your users to experiment and adapt *your* colorscheme to *their* needs, 12 | * you can focus on the design of your colorscheme rather than its implementation, 13 | * you can start working on new colorscheme ideas very easily. 14 | 15 | ## What do I need to use it? 16 | 17 | [ERB](https://ruby-doc.org/stdlib-2.6.3/libdoc/erb/rdoc/index.html), the templating engine used here, is part of Ruby's standard library so you will need [Ruby](https://www.ruby-lang.org/) to generate your colorscheme. Neither ERB nor Ruby knowledge is required, though. 18 | 19 | If you don't already have Ruby, the official site [has got your back](https://www.ruby-lang.org/en/documentation/installation/). 20 | 21 | ## How do I use it? 22 | 23 | The process is divided in five steps: 24 | 25 | 1. rename `colors/rnb.erb` to `colors/name_of_your_colorscheme.erb`, 26 | 2. edit your colorscheme's information, 27 | 3. define your colors, 28 | 4. define your highlight groups and links, 29 | 5. and generate your colorscheme. 30 | 31 | Steps 2 to 5 are thoroughly described in the [colorscheme template](https://github.com/romainl/vim-rnb/blob/master/colors/rnb.erb) itself in an effort to make it portable: if you ever decide to distribute your colorscheme you can simply package the template with it. 32 | 33 | ## Built with RNB 34 | 35 | The following colorschemes are known to be built with RNB: 36 | 37 | * [Apprentice](https://github.com/romainl/Apprentice) 38 | * [Dark Frost](https://github.com/Softmotions/vim-dark-frost-theme) 39 | * [Dichromatic](https://github.com/romainl/vim-dichromatic) 40 | * [Bruin](https://git.sr.ht/~romainl/vim-bruin) 41 | * [Sweet16](https://github.com/romainl/vim-sweet16) 42 | * [Paper](https://git.sr.ht/~swalladge/paper.vim) 43 | * [Journeyman](https://github.com/markeganfuller/vim-journeyman) 44 | * [Warlock](https://github.com/hardselius/warlock) 45 | * [Cyberpunk-Neon](https://github.com/Roboron3042/Cyberpunk-Neon) 46 | * [Tutfish](https://github.com/benwr/tuftish) 47 | * [Nisha](https://github.com/heraldofsolace/nisha-vim) 48 | * [Photon](https://github.com/axvr/photon.vim) 49 | * [vim-J](https://github.com/arthurealike/vim-J) 50 | * [crystalcove](https://github.com/jayhowie/crystal-cove) 51 | * [antarctic](https://sr.ht/~swalladge/antarctic-vim/) 52 | * [Stella](https://github.com/Shrimpram/vim-stella) 53 | * [Outrun](https://github.com/u03c1/outrun-vim) 54 | * [Raider](https://github.com/axvr/raider.vim) 55 | * [Mitra](https://github.com/wolandark/Mitra-Vim) 56 | * [Orbital](https://github.com/fcpg/vim-orbital) 57 | * (your colorscheme here, send us a PR!) 58 | 59 | ## TODO 60 | 61 | * `README.md` template 62 | 63 | 64 | [//]: # ( Vim: set spell spelllang=en: ) 65 | -------------------------------------------------------------------------------- /colors/rnb.erb: -------------------------------------------------------------------------------- 1 | <% 2 | # RNB, A VIM COLORSCHEME TEMPLATE 3 | # Author: Romain Lafourcade (https://github.com/romainl) 4 | # Canonical URL: https://github.com/romainl/vim-rnb 5 | 6 | # This template is designed to help vimmers create their own colorschemes 7 | # without much effort. 8 | # 9 | # You will need Ruby to generate your colorscheme but Ruby knowledge is 10 | # not needed at all. 11 | # 12 | # The process is divided in five steps: 13 | # 1. rename the template, 14 | # 2. edit your colorscheme's information, 15 | # 3. define your colors, 16 | # 4. define your highlight groups and links, 17 | # 5. and generate your colorscheme. 18 | 19 | # Step 1: renaming 20 | # 21 | # If this file is distributed with a colorscheme it's probably already named correctly 22 | # and you can skip this step. 23 | # 24 | # If you forked/cloned/copied this repository to create your own colorscheme, you will have to 25 | # rename this template to match the name of your colorscheme. 26 | # 27 | # NOTE: Vim doesn't really care about whitespace in the name of the colorscheme but it does for 28 | # filenames so make sure your filename doesn't have any whitespace character. 29 | # 30 | # colorscheme name | template filename | colorscheme filename 31 | # ------------------|-------------------|---------------------- 32 | # foobar | foobar.erb | foobar.vim 33 | # foo-bar | foo-bar.erb | foo-bar.vim 34 | # foo_bar | foo_bar.erb | foo_bar.vim 35 | # foo bar | foo-bar.erb or | foo-bar.vim or 36 | # | foo_bar.erb | foo_bar.vim 37 | 38 | # Step 2: information 39 | # 40 | # Make sure the name of your colorscheme is unique and attractive. 41 | # The description should fit in a single line with no linefeed. 42 | information = { 43 | author: "foo", 44 | email: "foo@foo.foo", 45 | name: "rnb", 46 | description: "Lorem ipsum dolor sit amet.", 47 | webpage: "http://www.example.com" 48 | } 49 | 50 | # Step 3: colors 51 | # 52 | # black = [ give each color a distinctive name 53 | # "#000000", hexadecimal color used in GVim/MacVim or "NONE" 54 | # 0, integer between 0 and 255 used by terminals supporting 256 colors 55 | # or "NONE" 56 | # "black" color name used by less capable color terminals, can be "darkred", 57 | # "red", "darkgreen", "green", "darkyellow", "yellow", "darkblue", 58 | # "blue", "darkmagenta", "magenta", "black", "darkgrey", "grey", 59 | # "white", or "NONE" 60 | # ] 61 | # 62 | # If your colors are defined correctly, the resulting colorscheme is guaranteed 63 | # to work in GVim (Windows/Linux), MacVim (MacOS), and any properly set up terminal emulator. 64 | black = ["#000000", 0, "black"] 65 | darkred = ["#800000", 1, "darkred"] 66 | darkgreen = ["#008000", 2, "darkgreen"] 67 | darkyellow = ["#808000", 3, "darkyellow"] 68 | darkblue = ["#000080", 4, "darkblue"] 69 | darkmagenta = ["#800080", 5, "darkmagenta"] 70 | darkcyan = ["#008080", 6, "darkcyan"] 71 | gray = ["#c0c0c0", 7, "gray"] 72 | darkgray = ["#808080", 8, "darkgray"] 73 | red = ["#ff0000", 9, "red"] 74 | green = ["#00ff00", 10, "green"] 75 | yellow = ["#ffff00", 11, "yellow"] 76 | blue = ["#0000ff", 12, "blue"] 77 | magenta = ["#ff00ff", 13, "magenta"] 78 | cyan = ["#00ffff", 14, "cyan"] 79 | white = ["#ffffff", 15, "white"] 80 | 81 | # Step 4: highlights 82 | # 83 | # You can define highlight groups like this: 84 | # 85 | # [ "Normal", name of the highlight group 86 | # white, the color used for background color, or use "NONE", "fg" or "bg" 87 | # darkgray, the color used for foreground color, or use "NONE", "fg" or "bg" 88 | # "NONE" style, can be "bold", "underline", "reverse", "italic", 89 | # "standout", "NONE", "undercurl", or a comma-separated list of 90 | # valid attributes like "underline,bold" 91 | # ] 92 | # 93 | # The sample above tells Vim to render normal text in dark gray against a white 94 | # background, without any other styling. 95 | # 96 | # Or you can link an highlight group to another. Here, "Title" will inherit its style from 97 | # "Normal": 98 | # 99 | # [ "Title", "Normal" ] 100 | # 101 | # In GUI Vim, there is an additional color for the undercurl used to 102 | # highlight spelling mistakes: 103 | # 104 | # [ "SpellBad", name of the highlight group 105 | # "NONE", the color used for background color, or use "NONE", "fg" or "bg" 106 | # red, the color used for foreground color, or use "NONE", "fg" or "bg" 107 | # "undercurl", style 108 | # red color used for the undercurl 109 | # ] 110 | # 111 | # The sample above tells Vim to render badly spelled words in red against the current 112 | # background, with a red undercurl. 113 | # 114 | # You can add any custom highlight group to the standard list below but you shouldn't 115 | # remove any if you want a working colorscheme. Most of them are described under 116 | # :help highlight-default, the others are taken from :help group-name. Both help sections 117 | # are good reads, by the way. 118 | highlights = [ 119 | [ "Normal", white, darkgray, "NONE" ], 120 | [ "NonText", white, darkgray, "NONE" ], 121 | [ "EndOfBuffer","NonText" ], 122 | [ "Comment", white, darkgray, "NONE" ], 123 | [ "Constant", white, darkgray, "NONE" ], 124 | [ "Error", white, darkgray, "NONE" ], 125 | [ "Identifier", white, darkgray, "NONE" ], 126 | [ "Ignore", white, darkgray, "NONE" ], 127 | [ "PreProc", white, darkgray, "NONE" ], 128 | [ "Special", white, darkgray, "NONE" ], 129 | [ "Statement", white, darkgray, "NONE" ], 130 | [ "String", white, darkgray, "NONE" ], 131 | [ "Number", "Constant" ], 132 | [ "Todo", white, darkgray, "NONE" ], 133 | [ "Type", white, darkgray, "NONE" ], 134 | [ "Underlined", white, darkgray, "NONE" ], 135 | [ "StatusLine", white, darkgray, "NONE" ], 136 | [ "StatusLineNC", white, darkgray, "NONE" ], 137 | [ "StatusLineTerm", "StatusLine" ], 138 | [ "StatusLineTermNC", "StatusLineNC" ], 139 | [ "VertSplit", white, darkgray, "NONE" ], 140 | [ "TabLine", white, darkgray, "NONE" ], 141 | [ "TabLineFill", white, darkgray, "NONE" ], 142 | [ "TabLineSel", white, darkgray, "NONE" ], 143 | [ "Title", white, darkgray, "NONE" ], 144 | [ "CursorLine", white, darkgray, "NONE" ], 145 | [ "LineNr", white, darkgray, "NONE" ], 146 | [ "CursorLineNr", white, darkgray, "NONE" ], 147 | [ "helpLeadBlank", white, darkgray, "NONE" ], 148 | [ "helpNormal", white, darkgray, "NONE" ], 149 | [ "Visual", white, darkgray, "NONE" ], 150 | [ "VisualNOS", white, darkgray, "NONE" ], 151 | [ "Pmenu", white, darkgray, "NONE" ], 152 | [ "PmenuSbar", white, darkgray, "NONE" ], 153 | [ "PmenuSel", white, darkgray, "NONE" ], 154 | [ "PmenuThumb", white, darkgray, "NONE" ], 155 | [ "FoldColumn", white, darkgray, "NONE" ], 156 | [ "Folded", white, darkgray, "NONE" ], 157 | [ "WildMenu", white, darkgray, "NONE" ], 158 | [ "SpecialKey", white, darkgray, "NONE" ], 159 | [ "DiffAdd", white, darkgray, "NONE" ], 160 | [ "DiffChange", white, darkgray, "NONE" ], 161 | [ "DiffDelete", white, darkgray, "NONE" ], 162 | [ "DiffText", white, darkgray, "NONE" ], 163 | [ "IncSearch", white, darkgray, "NONE" ], 164 | [ "Search", white, darkgray, "NONE" ], 165 | [ "Directory", white, darkgray, "NONE" ], 166 | [ "MatchParen", white, darkgray, "NONE" ], 167 | [ "SpellBad", white, darkgray, "NONE", red ], 168 | [ "SpellCap", white, darkgray, "NONE", blue ], 169 | [ "SpellLocal", white, darkgray, "NONE", magenta ], 170 | [ "SpellRare", white, darkgray, "NONE", cyan ], 171 | [ "ColorColumn", white, darkgray, "NONE" ], 172 | [ "SignColumn", white, darkgray, "NONE" ], 173 | [ "ErrorMsg", white, darkgray, "NONE" ], 174 | [ "ModeMsg", white, darkgray, "NONE" ], 175 | [ "MoreMsg", white, darkgray, "NONE" ], 176 | [ "Question", white, darkgray, "NONE" ], 177 | [ "WarningMsg", "Error" ], 178 | [ "Cursor", white, darkgray, "NONE" ], 179 | [ "CursorIM", "Cursor" ], 180 | [ "CursorColumn", white, darkgray, "NONE" ], 181 | [ "QuickFixLine", white, darkgray, "NONE" ], 182 | [ "Terminal", "Normal" ], 183 | [ "Conceal", white, darkgray, "NONE" ], 184 | [ "ToolbarLine", white, darkgray, "NONE" ], 185 | [ "ToolbarButton", white, darkgray, "NONE" ], 186 | [ "debugPC", white, darkgray, "NONE" ], 187 | [ "debugBreakpoint", white, darkgray, "NONE" ], 188 | ] 189 | 190 | # Define the color palette used by :terminal when in GUI Vim 191 | # or in TUI Vim when 'termguicolors' is enabled. If this list 192 | # is empty or if it doesn't contain exactly 16 items, the corresponding 193 | # Vim variable won't be set. 194 | # 195 | # The expected values are colors defined in step 3. 196 | # 197 | # Terminal emulators use a basic palette of 16 colors that can be 198 | # addressed by CLI and TUI tools via their name or their index, from 199 | # 0 to 15. The list is not really standardized but it is generally 200 | # assumed to look like this: 201 | # 202 | # Index | Name 203 | # -------|------------- 204 | # 0 | black 205 | # 1 | darkred 206 | # 2 | darkgreen 207 | # 3 | darkyellow 208 | # 4 | darkblue 209 | # 5 | darkmagenta 210 | # 6 | darkcyan 211 | # 7 | gray 212 | # 8 | darkgray 213 | # 9 | red 214 | # 10 | green 215 | # 11 | yellow 216 | # 12 | blue 217 | # 13 | magenta 218 | # 14 | cyan 219 | # 15 | white 220 | # 221 | # While you are certainly free to make colors 0 to 7 shades of blue, 222 | # this will inevitably cause usability issues so… be careful. 223 | terminal_ansi_colors = [ 224 | black, 225 | darkred, 226 | darkgreen, 227 | darkyellow, 228 | darkblue, 229 | darkmagenta, 230 | darkcyan, 231 | gray, 232 | darkgray, 233 | red, 234 | green, 235 | yellow, 236 | blue, 237 | magenta, 238 | cyan, 239 | white 240 | ] 241 | 242 | # Step 5: generation 243 | # 244 | # From a separate shell: 245 | # 246 | # $ erb -T - bar.erb > bar.vim 247 | # 248 | # From Vim: 249 | # 250 | # :!erb -T - % > %<.vim 251 | # 252 | # If this template comes with a Makefile, you can do it from a separate shell, 253 | # with the make program: 254 | # 255 | # $ make 256 | 257 | # These online resources can help you design your colorscheme: 258 | # 259 | # * http://upload.wikimedia.org/wikipedia/en/1/15/Xterm_256color_chart.svg 260 | # the xterm palette 261 | # * http://whatcolor.herokuapp.com/ 262 | # play with hexadecimal colors right in the address bar (currently down) 263 | # * http://color.hailpixel.com/ 264 | # similar concept, fuzzier implementation 265 | # * http://colourco.de/ 266 | # similar concept, fancier implementation 267 | # * http://www.colr.org/ 268 | # extract a palette from an image 269 | # * http://colores.manugarri.com/ 270 | # search for 'word', get images and color palettes 271 | # * http://www.colourlovers.com/palettes 272 | # user-created palettes 273 | # * http://www.perbang.dk/color+scheme/ 274 | # a no-nonsense colorscheme generator 275 | # * https://color.adobe.com/ 276 | # Adobe's fancy colorscheme generator 277 | # * http://paletton.com/ 278 | # The classic 'Color Scheme Designer', rebranded 279 | # * http://vrl.cs.brown.edu/color 280 | # A very smart palette generator 281 | # * https://cmcenroe.me/2018/04/03/colour-scheme.html 282 | # "I Made My Own Colour Scheme and You Can Too!" 283 | 284 | # A few general advices: 285 | # 286 | # * The Windows console is limited to the 16 so-called "ANSI" colors but it used to 287 | # have a few of them interverted which makes numbers impractical. Use color names 288 | # instead of numbers: :help cterm-colors 289 | # * The Windows console (yeah…) doesn't do italics, underlines or bolded text; 290 | # it is limited to normal and reverse. Keep that in mind if you want 291 | # your colorscheme to be usable in as many environments as possible by as many 292 | # people as possible. 293 | # * Actually, terminal emulators rarely do italics. 294 | # * All of the terminal emulators in use these days allow their users to 295 | # change the 16 so-called "ANSI" colors. It is also possible on some platforms 296 | # to change some or all of the 256 colors in the xterm palette. Don't take 297 | # anything for granted. 298 | # * When used against a light background, strong colors work better than muted 299 | # ones. Light or dark doesn't really matters. Also, it is harder to discriminate 300 | # between two similar colors on a light background. 301 | # * Both strong and muted colors work well against a dark background. It is also 302 | # easier to work with similar colors, but dark colors don't work at all. 303 | # * Use as many text samples as possible. String-heavy languages may look completely 304 | # different than keyword-heavy ones. This can have an impact on the usability 305 | # of your colorscheme. 306 | # * Most terminal emulators and terminal multiplexers currently in use on unix-like 307 | # systems support 256 colors but they almost always default to a '$TERM' that tells 308 | # Vim otherwise. Your users will need to make sure their terminal emulator/multiplexer 309 | # is correctly set up if they want to enjoy the best possible experience. 310 | 311 | # Many thanks to Barry Arthur (https://github.com/dahu) for the original idea. 312 | 313 | # You don't need to edit anything beyond this line. 314 | -%> 315 | " <%= information[:name] %>.vim -- Vim color scheme. 316 | " Author: <%= information[:author] %> (<%= information[:email] %>) 317 | " Webpage: <%= information[:webpage] %> 318 | " Description: <%= information[:description] %> 319 | " Last Change: <%= Time.new.strftime "%Y-%m-%d" %> 320 | 321 | hi clear 322 | 323 | if exists("syntax_on") 324 | syntax reset 325 | endif 326 | 327 | let colors_name = "<%= information[:name].downcase %>" 328 | 329 | if ($TERM =~ '256' || &t_Co >= 256) || has("gui_running") 330 | <% highlights.each do |highlight| -%> 331 | <% if highlight.length == 4 -%> 332 | hi <%= highlight[0] %> ctermbg=<%= highlight[1].kind_of?(String) ? highlight[1] : highlight[1][1] %> ctermfg=<%= highlight[2].kind_of?(String) ? highlight[2] : highlight[2][1] %> cterm=<%= highlight[3] %> guibg=<%= highlight[1].kind_of?(String) ? highlight[1] : highlight[1][0] %> guifg=<%= highlight[2].kind_of?(String) ? highlight[2] : highlight[2][0] %> gui=<%= highlight[3] %> 333 | <% elsif highlight.length > 4 -%> 334 | hi <%= highlight[0] %> ctermbg=<%= highlight[1].kind_of?(String) ? highlight[1] : highlight[1][1] %> ctermfg=<%= highlight[2].kind_of?(String) ? highlight[2] : highlight[2][1] %> cterm=<%= highlight[3] %> guibg=<%= highlight[1].kind_of?(String) ? highlight[1] : highlight[1][0] %> guifg=<%= highlight[2].kind_of?(String) ? highlight[2] : highlight[2][0] %> gui=<%= highlight[3] %> guisp=<%= highlight[4].kind_of?(String) ? highlight[4] : highlight[4][0] %> 335 | <% end -%> 336 | <% end -%> 337 | 338 | elseif &t_Co == 8 || $TERM !~# '^linux' || &t_Co == 16 339 | set t_Co=16 340 | <%= '' %> 341 | <% highlights.each do |highlight| -%> 342 | <% if highlight.length > 2 -%> 343 | hi <%= highlight[0] %> ctermbg=<%= highlight[1].kind_of?(String) ? highlight[1] : highlight[1][2] %> ctermfg=<%= highlight[2].kind_of?(String) ? highlight[2] : highlight[2][2] %> cterm=<%= highlight[3] %> 344 | <% end -%> 345 | <% end -%> 346 | endif 347 | <% links = highlights.select do |highlight| -%> 348 | <% highlight.length == 2 -%> 349 | <% end -%> 350 | <% if links.length > 0 -%> 351 | <%= '' %> 352 | <% links.each do |link| -%> 353 | hi link <%= link[0] %> <%= link[1] %> 354 | <% end -%> 355 | <% end -%> 356 | <% if terminal_ansi_colors.length == 16 -%> 357 | <%= '' %> 358 | if (has('termguicolors') && &termguicolors) || has('gui_running') 359 | let g:terminal_ansi_colors = [ <%= terminal_ansi_colors.map { |color| "'#{color[0]}'" }.join(', ') %> ] 360 | endif 361 | <% end -%> 362 | 363 | " Generated with RNB (https://github.com/romainl/vim-rnb) 364 | --------------------------------------------------------------------------------