Skip to content

Instantly share code, notes, and snippets.

@cwonrails
Forked from romainl/_rnb.md
Last active August 29, 2015 14:26
Show Gist options
  • Save cwonrails/67c0e4b57c30c06ea349 to your computer and use it in GitHub Desktop.
Save cwonrails/67c0e4b57c30c06ea349 to your computer and use it in GitHub Desktop.
RNB, a Vim colorscheme template
<%
# 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 first 16 colors of the xterm palette and
# are only here as an example. You can get rid of them, 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, defined above, used for background color or, use "NONE"
# darkgray, color, defined above, used for foreground color or, use "NONE"
# "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, defined above, used for background color, or use "NONE"
# red, color, defined above, used for foreground color, or use "NONE"
# "undercurl", style
# red color used for the undercurl
# ]
#
# The highlight groups below are fairly standard but some syntax scripts and
# plugins may define their own. Feel free to append them to this array as needed.
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
# These online resources can help you design your colorscheme:
# * http://upload.wikimedia.org/wikipedia/en/1/15/Xterm_256color_chart.svg
# the xterm palette
# * http://whatcolor.herokuapp.com/
# play with hexadecimal colors right in the address bar
# * http://www.colr.org/
# extract a palette from an image
# * http://www.colourlovers.com/palettes
# user-created palettes
# * http://color.hailpixel.com/
# very intuitive but very fuzzy colorscheme creator
# * http://colourco.de/
# similar to the above
# * http://www.perbang.dk/color+scheme/
# a no-nonsense colorscheme generator
# * https://color.adobe.com/
# Adobe's colorscheme generator
# * http://paletton.com/
# The classic 'Color Scheme Designer', rebranded
# * http://colores.manugarri.com/
# search for 'word', get images and color palettes
# Thanks to Barry Arthur (https://github.com/dahu) for the original idea.
# You don't need to edit anything beyond this line.
-%>
" <%= 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
" Generated with RNB (https://gist.github.com/romainl/5cd2f4ec222805f49eca)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment