diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..015bbd6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Joshua Dick + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f3de8fb --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# onedark.vim + +A dark Vim colorscheme for the GUI and 256-color terminals, based on [FlatColor](https://github.com/MaxSt/FlatColor), with colors inspired by the excellent [One Dark syntax theme](https://github.com/atom/one-dark-syntax) for the [Atom text editor](https://atom.io). + +## Installation + +Place `onedark.vim` in your `~/.vim/colors/` directory either manually or by using your Vim plug-in manager of choice, then add the following lines to your `~/.vimrc`: + + syntax on + colorscheme onedark + +## Options + +* `g:onedark_termcolors`: Set to `256` for 256-color terminals (the default), or set to `16` to use your terminal emulator's native colors. A 16-color palette for this theme is not available yet. + +* `g:onedark_terminal_italics`: Set to `1` if your terminal emulator supports italics; `0` otherwise (the default). diff --git a/colors/onedark.vim b/colors/onedark.vim new file mode 100644 index 0000000..5ec2b6b --- /dev/null +++ b/colors/onedark.vim @@ -0,0 +1,192 @@ +" Vim Color File +" Name: onedark.vim +" Version: 1.0 +" Maintainer: https://github.com/joshdick/onedark.vim/ +" License: The MIT License (MIT) +" Based On: https://github.com/MaxSt/FlatColor/ + +" +----------------+ +" | Initialization | +" +----------------+ + +set background=dark + +highlight clear + +if exists("syntax_on") + syntax reset +endif + +let g:colors_name="onedark" + +" Set to "256" for 256-color terminals, or +" set to "16" to use your terminal emulator's native colors +" (a 16-color palette for this theme is not available yet.) +if !exists("g:onedark_termcolors") + let g:onedark_termcolors = 256 +endif + +" Mot all terminals support italics properly. If yours does, opt-in. +if !exists("g:onedark_terminal_italics") + let g:onedark_terminal_italics = 0 +endif + +" This function was borrowed from FlatColor: https://github.com/MaxSt/FlatColor/ +" It was based on one found in hemisu: https://github.com/noahfrederick/vim-hemisu/ +function! s:h(group, style) + if g:onedark_terminal_italics == 0 && has_key(a:style, "cterm") && a:style["cterm"] == "italic" + unlet a:style.cterm + endif + if g:onedark_termcolors == 16 + let l:ctermfg = (has_key(a:style, "fg") ? a:style.fg.cterm16 : "NONE") + let l:ctermbg = (has_key(a:style, "bg") ? a:style.bg.cterm16 : "NONE") + else + let l:ctermfg = (has_key(a:style, "fg") ? a:style.fg.cterm : "NONE") + let l:ctermbg = (has_key(a:style, "bg") ? a:style.bg.cterm : "NONE") + end + execute "highlight" a:group + \ "guifg=" (has_key(a:style, "fg") ? a:style.fg.gui : "NONE") + \ "guibg=" (has_key(a:style, "bg") ? a:style.bg.gui : "NONE") + \ "guisp=" (has_key(a:style, "sp") ? a:style.sp.gui : "NONE") + \ "gui=" (has_key(a:style, "gui") ? a:style.gui : "NONE") + \ "ctermfg=" . l:ctermfg + \ "ctermbg=" . l:ctermbg + \ "cterm=" (has_key(a:style, "cterm") ? a:style.cterm : "NONE") +endfunction + +" +-----------------+ +" | Color Variables | +" +-----------------+ + +let s:red = { "gui": "#E06C75", "cterm": "204", "cterm16": "1"} " Alternate cterm: 168 +"let s:dark_red = { "gui": "#e64040", "cterm": "196", "cterm16": "9"} + +let s:green = { "gui": "#98C379", "cterm": "114", "cterm16": "2"} +"let s:dark_green = { "gui": "#6dc35c", "cterm": "36", "cterm16": "10"} + +let s:yellow = { "gui": "#E5C07B", "cterm": "180", "cterm16": "3"} +let s:dark_yellow = { "gui": "#D19A66", "cterm": "173", "cterm16": "11"} + +let s:blue = { "gui": "#61AFEF", "cterm": "39", "cterm16": "4"} " Alternate cterm: 75 +"let s:dark_blue = { "gui": "#6097dc", "cterm": "32", "cterm16": "12"} + +let s:purple = { "gui": "#C678DD", "cterm": "170", "cterm16": "5"} " Alternate cterm: 176 +"let s:dark_purple = { "gui": "#8d73de", "cterm": "55", "cterm16": "13"} + +let s:cyan = { "gui": "#56B6C2", "cterm": "38", "cterm16": "6"} " Alternate cterm: 73 +"let s:dark_cyan = { "gui": "#53d3d2", "cterm": "110", "cterm16": "14"} + +let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16" : "7" } + +let s:black = { "gui": "#282C34", "cterm": "235", "cterm16": "8" } + +let s:comment_grey = { "gui": "#5C6670", "cterm": "59", "cterm16": "15" } +let s:gutter_fg_grey = { "gui": "#636D83", "cterm": "238", "cterm16": "15" } +let s:gutter_bg_grey = { "gui": "#2C313A", "cterm": "NONE", "cterm16": "NONE" } +let s:cursor_grey = { "gui": "#2C323B", "cterm": "236", "cterm16": "15" } " TODO: This cterm16 value doesn't work great here +let s:visual_grey = { "gui": "#3E4451", "cterm": "237", "cterm16": "15" } +let s:special_grey = { "gui": "#383C45", "cterm": "238", "cterm16": "15" } +let s:vertsplit = { "gui": "#181A1F", "cterm": "59", "cterm16": "15" } + +" +---------------------------------------------------------+ +" | Syntax Groups (descriptions and ordering from `:h w18`) | +" +---------------------------------------------------------+ + +call s:h("Comment", { "fg": s:comment_grey, "gui": "italic", "cterm": "italic" }) " any comment +call s:h("Constant", {}) " any constant +call s:h("String", { "fg": s:green }) " a string constant: "this is a string" +call s:h("Character", { "fg": s:green }) " a character constant: 'c', '\n' +call s:h("Number", { "fg": s:dark_yellow }) " a number constant: 234, 0xff +call s:h("Boolean", { "fg": s:dark_yellow }) " a boolean constant: TRUE, false +call s:h("Float", { "fg": s:dark_yellow }) " a floating point constant: 2.3e10 +call s:h("Identifier", { "fg": s:red }) " any variable name +call s:h("Function", {}) " function name (also: methods for classes) +call s:h("Statement", { "fg": s:purple }) " any statement +call s:h("Conditional", { "fg": s:purple }) " if, then, else, endif, switch, etc. +call s:h("Repeat", { "fg": s:purple }) " for, do, while, etc. +call s:h("Label", { "fg": s:purple }) " case, default, etc. +call s:h("Operator", {}) " sizeof", "+", "*", etc. +call s:h("Keyword", { "fg": s:red }) " any other keyword +call s:h("Exception", { "fg": s:purple }) " try, catch, throw +call s:h("PreProc", { "fg": s:yellow }) " generic Preprocessor +call s:h("Include", {}) " preprocessor #include +call s:h("Define", {}) " preprocessor #define +call s:h("Macro", {}) " same as Define +call s:h("PreCondit", {}) " preprocessor #if, #else, #endif, etc. +call s:h("Type", {}) " int, long, char, etc. +call s:h("StorageClass", {}) " static, register, volatile, etc. +call s:h("Structure", {}) " struct, union, enum, etc. +call s:h("Typedef", {}) " A typedef +call s:h("Special", { "fg": s:blue }) " any special symbol +call s:h("SpecialChar", {}) " special character in a constant +call s:h("Tag", {}) " you can use CTRL-] on this +call s:h("Delimiter", {}) " character that needs attention +call s:h("SpecialComment", {}) " special things inside a comment +call s:h("Debug", {}) " debugging statements +call s:h("Underlined", {}) " text that stands out, HTML links +call s:h("Ignore", {}) " left blank, hidden +call s:h("Error", { "fg": s:red, "bg": s:gutter_bg_grey }) " any erroneous construct +call s:h("Todo", { "fg": s:purple }) " anything that needs extra attention; mostly the keywords TODO FIXME and XXX + +" +----------------------------------------------------------------------+ +" | Highlighting Groups (descriptions and ordering from `:h hitest.vim`) | +" +----------------------------------------------------------------------+ + +call s:h("ColorColumn", { "bg": s:cursor_grey }) " used for the columns set with 'colorcolumn' +call s:h("Conceal", {}) " placeholder characters substituted for concealed text (see 'conceallevel') +call s:h("Cursor", { "fg": s:black, "bg": s:blue }) " the character under the cursor +call s:h("CursorIM", {}) " like Cursor, but used when in IME mode +call s:h("CursorColumn", { "bg": s:cursor_grey }) " the screen column that the cursor is in when 'cursorcolumn' is set +call s:h("CursorLine", { "bg": s:cursor_grey }) " the screen line that the cursor is in when 'cursorline' is set +call s:h("Directory", {}) " directory names (and other special names in listings) +call s:h("DiffAdd", { "fg": s:green }) " diff mode: Added line +call s:h("DiffChange", { "fg": s:dark_yellow }) " diff mode: Changed line +call s:h("DiffDelete", { "fg": s:red }) " diff mode: Deleted line +call s:h("DiffText", { "fg": s:blue }) " diff mode: Changed text within a changed line +call s:h("ErrorMsg", {}) " error messages on the command line +call s:h("VertSplit", { "fg": s:vertsplit }) " the column separating vertically split windows +call s:h("Folded", {}) " line used for closed folds +call s:h("FoldColumn", {}) " 'foldcolumn' +call s:h("SignColumn", {}) " column where signs are displayed +call s:h("IncSearch", {}) " 'incsearch' highlighting; also used for the text replaced with ":s///c" +call s:h("LineNr", { "fg": s:gutter_fg_grey, "bg": s:gutter_bg_grey }) " Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. +call s:h("CursorLineNr", {}) " Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. +call s:h("MatchParen", {}) " The character under the cursor or just before it, if it is a paired bracket, and its match. +call s:h("ModeMsg", {}) " 'showmode' message (e.g., "-- INSERT --") +call s:h("MoreMsg", {}) " more-prompt +call s:h("NonText", { "fg": s:special_grey }) " '~' and '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). +call s:h("Normal", { "fg": s:white, "bg": s:black }) " normal text +call s:h("Pmenu", {}) " Popup menu: normal item. +call s:h("PmenuSel", { "bg": s:visual_grey }) " Popup menu: selected item. +call s:h("PmenuSbar", { "bg": s:visual_grey }) " Popup menu: scrollbar. +call s:h("PmenuThumb", { "bg": s:white }) " Popup menu: Thumb of the scrollbar. +call s:h("Question", { "fg": s:purple }) " hit-enter prompt and yes/no questions +call s:h("Search", { "bg": s:visual_grey }) " Last search pattern highlighting (see 'hlsearch'). Also used for highlighting the current line in the quickfix window and similar items that need to stand out. +call s:h("SpecialKey", { "fg": s:special_grey }) " Meta and special keys listed with ":map", also for text used to show unprintable characters in the text, 'listchars'. Generally: text that is displayed differently from what it really is. +call s:h("SpellBad", { "fg": s:red }) " Word that is not recognized by the spellchecker. This will be combined with the highlighting used otherwise. +call s:h("SpellCap", { "fg": s:dark_yellow }) " Word that should start with a capital. This will be combined with the highlighting used otherwise. +call s:h("SpellLocal", { "fg": s:dark_yellow }) " Word that is recognized by the spellchecker as one that is used in another region. This will be combined with the highlighting used otherwise. +call s:h("SpellRare", { "fg": s:dark_yellow }) " Word that is recognized by the spellchecker as one that is hardly ever used. spell This will be combined with the highlighting used otherwise. +call s:h("StatusLine", { "fg": s:white }) " status line of current window +call s:h("StatusLineNC", { "fg": s:comment_grey }) " status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. +call s:h("TabLine", {}) " tab pages line, not active tab page label +call s:h("TabLineFill", {}) " tab pages line, where there are no labels +call s:h("TabLineSel", {}) " tab pages line, active tab page label +call s:h("Title", { "fg": s:green }) " titles for output from ":set all", ":autocmd" etc. +call s:h("Visual", { "bg": s:visual_grey }) " Visual mode selection +call s:h("VisualNOS", { "bg": s:visual_grey }) " Visual mode selection when vim is "Not Owning the Selection". Only X11 Gui's gui-x11 and xterm-clipboard supports this. +call s:h("WarningMsg", { "fg": s:red }) " warning messages +call s:h("WildMenu", {}) " current match in 'wildmenu' completion + +" +---------------------+ +" | Plugin Highlighting | +" +---------------------+ + +" Signify, git-gutter +hi link SignifySignAdd LineNr +hi link SignifySignDelete LineNr +hi link SignifySignChange LineNr +call s:h("GitGutterAdd", { "fg": s:green, "bg": s:gutter_bg_grey }) +call s:h("GitGutterDelete", { "fg": s:red, "bg": s:gutter_bg_grey }) +call s:h("GitGutterChange", { "fg": s:yellow, "bg": s:gutter_bg_grey }) +call s:h("GitGutterChangeDelete", { "fg": s:red, "bg": s:gutter_bg_grey })