-
-
Save cwonrails/67c0e4b57c30c06ea349 to your computer and use it in GitHub Desktop.
RNB, a Vim colorscheme template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% | |
| # RNB, A VIM COLORSCHEME TEMPLATE | |
| # This template is designed to let you create your Vim colorscheme | |
| # with little effort. | |
| # | |
| # The only requirement for using this template is Ruby. | |
| # | |
| # The process is divided in four steps: | |
| # 1. start by editing your colorscheme's metadata, | |
| # 2. define your colors, | |
| # 3. define your highlight groups and links, | |
| # 4. and generate your colorscheme. | |
| # Step 1: metadata | |
| # | |
| # Make sure the name of your colorscheme is unique and attractive. | |
| # The description should fit in a single line with no linefeed. | |
| # 'background' can be "light" or "dark" | |
| metadata = { | |
| author: "foo", | |
| email: "[email protected]", | |
| name: "bar", | |
| description: "Lorem ipsum dolor sit amet.", | |
| background: "light" | |
| } | |
| # Step 2: colors | |
| # | |
| # darkgray = [ give your color a convenient name | |
| # '#000000', hexadecimal color for GVim/MacVim | |
| # 0, integer between 0 and 255 for terminals supporting 256 colors | |
| # 0 integer between 0 and 15 for terminals limited to 16 colors | |
| # ] | |
| # | |
| # The colors below are the 16 first colors of the xterm palette and | |
| # are only here as an example. You can get rid of it, I won't be mad. | |
| darkgray = ['#000000', 0, 0] | |
| darkred = ['#800000', 1, 1] | |
| darkgreen = ['#008000', 2, 2] | |
| darkyellow = ['#808000', 3, 3] | |
| darkblue = ['#000080', 4, 4] | |
| darkmagenta = ['#800080', 5, 5] | |
| darkcyan = ['#008080', 6, 6] | |
| darkwhite = ['#c0c0c0', 7, 7] | |
| gray = ['#808080', 8, 8] | |
| red = ['#ff0000', 9, 9] | |
| green = ['#00ff00', 10, 10] | |
| yellow = ['#ffff00', 11, 11] | |
| blue = ['#0000ff', 12, 12] | |
| magenta = ['#ff00ff', 13, 13] | |
| cyan = ['#00ffff', 14, 14] | |
| white = ['#ffffff', 15, 15] | |
| # Step 3: highlights | |
| # | |
| # you can define an highlight group like this: | |
| # [ "Normal", name of the highlight group | |
| # white, color used for background color, defined above | |
| # darkgray, color used for foreground color, defined above | |
| # "NONE" style, can be "bold", "underline", "reverse", "italic", | |
| # "standout", "NONE" or "undercurl" | |
| # ] | |
| # | |
| # or link an highlight group to another: | |
| # [ "Title", "Normal" ] | |
| # | |
| # You can define an additional color for the undercurl used for | |
| # highlighting spelling mistakes: | |
| # [ "SpellBad", name of the highlight group | |
| # "NONE", color used for background color, defined above | |
| # red, color used for foreground color, defined above | |
| # "undercurl", style, can be "bold", "underline", "reverse", "italic", | |
| # "standout", "NONE" or "undercurl" | |
| # red color used for the undercurl | |
| # ] | |
| highlights = [ | |
| [ "Normal", white, darkgray, "NONE" ], | |
| [ "NonText", white, darkgray, "NONE" ], | |
| [ "Comment", white, darkgray, "NONE" ], | |
| [ "Constant", white, darkgray, "NONE" ], | |
| [ "Error", white, darkgray, "NONE" ], | |
| [ "Identifier", white, darkgray, "NONE" ], | |
| [ "Ignore", white, darkgray, "NONE" ], | |
| [ "PreProc", white, darkgray, "NONE" ], | |
| [ "Special", white, darkgray, "NONE" ], | |
| [ "Statement", white, darkgray, "NONE" ], | |
| [ "String", white, darkgray, "NONE" ], | |
| [ "Todo", white, darkgray, "NONE" ], | |
| [ "Type", white, darkgray, "NONE" ], | |
| [ "Underlined", white, darkgray, "NONE" ], | |
| [ "StatusLine", white, darkgray, "NONE" ], | |
| [ "StatusLineNC", white, darkgray, "NONE" ], | |
| [ "VertSplit", white, darkgray, "NONE" ], | |
| [ "TabLine", white, darkgray, "NONE" ], | |
| [ "TabLineFill", white, darkgray, "NONE" ], | |
| [ "TabLineSel", white, darkgray, "NONE" ], | |
| [ "Title", white, darkgray, "NONE" ], | |
| [ "CursorLine", white, darkgray, "NONE" ], | |
| [ "LineNr", white, darkgray, "NONE" ], | |
| [ "CursorLineNr", white, darkgray, "NONE" ], | |
| [ "helpLeadBlank", white, darkgray, "NONE" ], | |
| [ "helpNormal", white, darkgray, "NONE" ], | |
| [ "Visual", white, darkgray, "NONE" ], | |
| [ "VisualNOS", white, darkgray, "NONE" ], | |
| [ "Pmenu", white, darkgray, "NONE" ], | |
| [ "PmenuSbar", white, darkgray, "NONE" ], | |
| [ "PmenuSel", white, darkgray, "NONE" ], | |
| [ "PmenuThumb", white, darkgray, "NONE" ], | |
| [ "FoldColumn", white, darkgray, "NONE" ], | |
| [ "Folded", white, darkgray, "NONE" ], | |
| [ "WildMenu", white, darkgray, "NONE" ], | |
| [ "SpecialKey", white, darkgray, "NONE" ], | |
| [ "DiffAdd", white, darkgray, "NONE" ], | |
| [ "DiffChange", white, darkgray, "NONE" ], | |
| [ "DiffDelete", white, darkgray, "NONE" ], | |
| [ "DiffText", white, darkgray, "NONE" ], | |
| [ "IncSearch", white, darkgray, "NONE" ], | |
| [ "Search", white, darkgray, "NONE" ], | |
| [ "Directory", white, darkgray, "NONE" ], | |
| [ "MatchParen", white, darkgray, "NONE" ], | |
| [ "SpellBad", white, darkgray, "NONE", red ], | |
| [ "SpellCap", white, darkgray, "NONE", blue ], | |
| [ "SpellLocal", white, darkgray, "NONE", magenta ], | |
| [ "SpellRare", white, darkgray, "NONE", cyan ], | |
| [ "ColorColumn", white, darkgray, "NONE" ], | |
| [ "signColumn", white, darkgray, "NONE" ], | |
| [ "ErrorMsg", white, darkgray, "NONE" ], | |
| [ "ModeMsg", white, darkgray, "NONE" ], | |
| [ "MoreMsg", white, darkgray, "NONE" ], | |
| [ "Question", white, darkgray, "NONE" ], | |
| [ "WarningMsg", white, darkgray, "NONE" ], | |
| [ "Cursor", white, darkgray, "NONE" ], | |
| [ "CursorColumn", white, darkgray, "NONE" ] | |
| ] | |
| # Step 4: generation | |
| # | |
| # From a shell: | |
| # $ erb -T - bar.erb > bar.vim | |
| # | |
| # From Vim: | |
| # :!erb -T - % > bar.vim | |
| # You don't need to edit anything beyond this line. | |
| # Thanks to Barry Arthur (https://github.com/dahu) for the original idea. | |
| -%> | |
| " <%= metadata[:name] %>.vim -- Vim color scheme. | |
| " Author: <%= metadata[:author] %> (<%= metadata[:email] %>) | |
| " Description: <%= metadata[:description] %> | |
| hi clear | |
| if exists('syntax_on') | |
| syntax reset | |
| endif | |
| let colors_name = '<%= metadata[:name] %>' | |
| if &t_Co >= 256 || has('gui_running') | |
| <% for highlight in highlights -%> | |
| <% if highlight.length == 2 -%> | |
| hi link <%= highlight[0] %> <%= highlight[1] %> | |
| <% elsif highlight.length == 4 -%> | |
| hi <%= highlight[0] %> ctermbg=<%= highlight[1][1] %> ctermfg=<%= highlight[2][1] %> cterm=<%= highlight[3] %> guibg=<%= highlight[1][0] %> guifg=<%= highlight[2][0] %> gui=<%= highlight[3] %> | |
| <% else -%> | |
| hi <%= highlight[0] %> ctermbg=<%= highlight[1][1] %> ctermfg=<%= highlight[2][1] %> cterm=<%= highlight[3] %> guibg=<%= highlight[1][0] %> guifg=<%= highlight[2][0] %> gui=<%= highlight[3] %> guisp=<%= highlight[4][0] %> | |
| <% end -%> | |
| <% end -%> | |
| set background=<%= metadata[:background] %> | |
| elseif &t_Co == 8 || $TERM !~# '^linux' || &t_Co == 16 | |
| set t_Co=16 | |
| <% for highlight in highlights -%> | |
| <% if highlight.length == 2 -%> | |
| hi link <%= highlight[0] %> <%= highlight[1] %> | |
| <% else -%> | |
| hi <%= highlight[0] %> ctermbg=<%= highlight[1][2] %> ctermfg=<%= highlight[2][2] %> cterm=<%= highlight[3] %> | |
| <% end -%> | |
| <% end -%> | |
| set background=<%= metadata[:background] %> | |
| endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment