Build system that centralizes color definitions (#81)

* Initial stab at a build system in order to centralize color definitions.

* Flesh out the build system more and add contribution guidelines.

Still missing airline template.

* Templatize airline theme
This commit is contained in:
Josh Dick
2017-02-19 13:27:49 -05:00
committed by GitHub
parent e0f5294c3d
commit 92fd37ee12
12 changed files with 887 additions and 22 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
build/node_modules

59
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,59 @@
# Contributing to onedark.vim
Please read this document before submitting a Pull Request.
**Pull Requests containing changes to files in the `autoload/` or `colors/` directories without corresponding changes to files in the `build/templates` directory will _not_ be merged.**
## Build System
### Background Information
onedark.vim and its companion [lightline.vim](https://github.com/itchyny/lightline.vim) and [vim-airline](https://github.com/vim-airline/vim-airline) themes are built using a rudimentary templating and build system that allows color definitions to live in a single, central file.
The basic idea is that the theme files are generated by a build tool, which in turn substitutes color values into templates that live in `build/templates`.
Here are the locations of the theme files that are generated by the build system, along with the locations of the corresponding templates they are generated from:
| Theme Location | Template Location |
|----------------------------------------------|------------------------------------------|
| `colors/onedark.vim` | `build/templates/onedark.template.vim` |
| `autoload/lightline/colorscheme/onedark.vim` | `build/templates/lightline.template.vim` |
| `autoload/airline/themes/onedark.vim` | `build/templates/airline.template.vim` |
### Configure It
1) Install [Node.js](https://nodejs.org/en/) (Installing via [nvm](https://github.com/creationix/nvm) or [homebrew](https://brew.sh) are both better options than the official Node.js installer.)
2) Run the following from within the root of this repository. This will install the build system's dependencies and will automatically configure a Git pre-commit hook that runs `npm test` (see below).
```bash
> cd build
> npm install
```
That's it!
### Use It
The build system consists of a single Node.js script, `build.js`, which supports two commands:
* Running `./build.js` or `npm run build` generates theme files from the templates, **overwriting changes to the theme files without confirmation.**
* Running `./build.js check` or `npm test` checks that the theme files match the template-generated output, **without modifying theme files**. This command ensures that the theme files perfectly match the templates they are generated from, which is useful for detecting changes that were made to generated theme files but that should have been made in the templates. (In addition to running `./build.js check`, `npm test` also runs [eslint](http://eslint.org) linting on the build system code to catch and prevent simple problems with changes to that code.)
The basic development workflow looks like this:
1. Make changes to the appropriate template files in `build/templates`, then run `npm run build` from inside the `build` directory.
2. Commit your change in Git. `npm test` will automatically run before your commit is finalized. If the test fails, fix any inconsistencies between the template files and theme files (or linting errors in `build.js` if applicable), then try committing again.
## Style Guidelines
Please match the existing comment and whitespace style in all template files.
For the "Language-Specific Highlighting" portion of onedark.vim, blocks for each language should be organized alphabetically ("Markdown" comes before "PHP").
Any changes to the JavaScript code in the build system should pass against the included eslint rules; you can manually check for linting errors by running `npm test` from inside the `build` directory.
## Thanks!
Thanks very much for contributing to onedark.vim!

View File

@@ -142,6 +142,10 @@ More examples of highlight group names and style data can be found in onedark.vi
If you'd like a tmux theme that complements onedark.vim, [@odedlaz has you covered](https://github.com/odedlaz/tmux-onedark-theme).
### Contributing
If you'd like to contribute to onedark.vim, check out the [contribution guidelines](./CONTRIBUTING.md).
---
Preview images were taken using:

View File

@@ -9,12 +9,12 @@ function! airline#themes#onedark#refresh()
let g:airline#themes#onedark#palette = {}
let g:airline#themes#onedark#palette.accents = {
\ 'red': airline#themes#get_highlight('Constant'),
\ 'red': [ '#E06C75', '', 204, 0 ]
\ }
let s:N1 = airline#themes#get_highlight2(['Cursor', 'fg'], ['String', 'fg'])
let s:N2 = airline#themes#get_highlight('Pmenu')
let s:N3 = airline#themes#get_highlight('String')
let s:N1 = [ '#282C34', '#98C379', 235, 114 ]
let s:N2 = [ '#ABB2BF', '#3E4452', 145, 237 ]
let s:N3 = [ '#98C379', '#282C34', 114, 235 ]
let g:airline#themes#onedark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let group = airline#themes#get_highlight('vimCommand')
@@ -22,26 +22,26 @@ function! airline#themes#onedark#refresh()
\ 'airline_c': [ group[0], '', group[2], '', '' ]
\ }
let s:I1 = airline#themes#get_highlight('Cursor')
let s:I1 = [ '#282C34', '#61AFEF', 235, 39 ]
let s:I2 = s:N2
let s:I3 = airline#themes#get_highlight2(['Cursor', 'bg'], ['Cursor', 'fg'])
let s:I3 = [ '#61AFEF', '#282C34', 39, 235 ]
let g:airline#themes#onedark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#onedark#palette.insert_modified = g:airline#themes#onedark#palette.normal_modified
let s:R1 = airline#themes#get_highlight2(['Cursor', 'fg'], ['Error', 'fg'])
let s:R1 = [ '#282C34', '#E06C75', 235, 204 ]
let s:R2 = s:N2
let s:R3 = airline#themes#get_highlight('Error')
let s:R3 = [ '#E06C75', '#282C34', 204, 235 ]
let g:airline#themes#onedark#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
let g:airline#themes#onedark#palette.replace_modified = g:airline#themes#onedark#palette.normal_modified
let s:V1 = airline#themes#get_highlight2(['Cursor', 'fg'], ['Statement', 'fg'])
let s:V1 = [ '#282C34', '#C678DD', 235, 170 ]
let s:V2 = s:N2
let s:V3 = airline#themes#get_highlight2(['Statement', 'fg'], ['Cursor', 'fg'])
let s:V3 = [ '#C678DD', '#282C34', 170, 235 ]
let g:airline#themes#onedark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#onedark#palette.visual_modified = g:airline#themes#onedark#palette.normal_modified
let s:IA1 = airline#themes#get_highlight2(['Cursor', 'fg'], ['Normal', 'fg'])
let s:IA2 = airline#themes#get_highlight2(['Normal', 'fg'], ['Visual', 'bg'])
let s:IA1 = [ '#282C34', '#ABB2BF', 235, 145 ]
let s:IA2 = [ '#ABB2BF', '#3E4452', 145, 237 ]
let s:IA3 = s:N2
let g:airline#themes#onedark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
let g:airline#themes#onedark#palette.inactive_modified = {
@@ -51,7 +51,7 @@ function! airline#themes#onedark#refresh()
" Warning/Error styling code from vim-airline's ["base16" theme](https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/base16.vim)
" Warnings
let s:WI = airline#themes#get_highlight2(['Cursor', 'fg'], ['WarningMsg', 'fg'], 'bold')
let s:WI = [ '#282C34', '#E5C07B', 235, 180 ]
let g:airline#themes#onedark#palette.normal.airline_warning = [
\ s:WI[0], s:WI[1], s:WI[2], s:WI[3]
\ ]
@@ -78,7 +78,7 @@ function! airline#themes#onedark#refresh()
\ g:airline#themes#onedark#palette.normal.airline_warning
" Errors
let s:ER = airline#themes#get_highlight2(['Cursor', 'fg'], ['ErrorMsg', 'fg'], 'bold')
let s:ER = [ '#282C34', '#E06C75', 235, 204 ]
let g:airline#themes#onedark#palette.normal.airline_error = [
\ s:ER[0], s:ER[1], s:ER[2], s:ER[3]
\ ]

28
build/.eslintrc.json Normal file
View File

@@ -0,0 +1,28 @@
{
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
"no-console": [
"off"
],
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"never"
]
}
}

104
build/build.js Executable file
View File

@@ -0,0 +1,104 @@
#!/usr/bin/env node
const doT = require('doT')
const { readFileSync, writeFileSync } = require('fs')
const { resolve } = require('path')
doT.templateSettings.strip = false // preserve whitespace
const baseColors = Object.freeze({
red: { gui: '#E06C75', cterm: '204', cterm16: '1' }, // alternate cterm: 168
dark_red: { gui: '#BE5046', cterm: '196', cterm16: '9' },
green: { gui: '#98C379', cterm: '114', cterm16: '2' },
yellow: { gui: '#E5C07B', cterm: '180', cterm16: '3' },
dark_yellow: { gui: '#D19A66', cterm: '173', cterm16: '11' },
blue: { gui: '#61AFEF', cterm: '39', cterm16: '4' }, // alternate cterm: 75
purple: { gui: '#C678DD', cterm: '170', cterm16: '5' }, // alternate cterm: 176
cyan: { gui: '#56B6C2', cterm: '38', cterm16: '6' }, // alternate cterm: 73
white: { gui: '#ABB2BF', cterm: '145', cterm16 : '7' },
black: { gui: '#282C34', cterm: '235', cterm16: '0' }
})
const specialColors = Object.freeze({
comment_grey: { gui: '#5C6370', cterm: '59', cterm16: '15' },
gutter_fg_grey: { gui: '#636D83', cterm: '238', cterm16: '15' },
cursor_grey: { gui: '#2C323C', cterm: '236', cterm16: '8' },
visual_grey: { gui: '#3E4452', cterm: '237', cterm16: '15' },
menu_grey: { cterm16: '8' }, // vim theme handles gui/cterm values
special_grey: { gui: '#3B4048', cterm: '238', cterm16: '15' },
vertsplit: { gui: '#181A1F', cterm: '59', cterm16: '15' },
})
const colors = Object.assign({}, baseColors, specialColors)
const templateMap = Object.freeze({
'./templates/onedark.template.vim': '../colors/onedark.vim',
'./templates/lightline.template.vim': '../autoload/lightline/colorscheme/onedark.vim',
'./templates/airline.template.vim': '../autoload/airline/themes/onedark.vim'
})
const shouldCheck = String(process.argv[2]).toLowerCase() === 'check'
const handleError = (message, cause) => {
console.error('Error:', message)
if (cause) console.error('Cause:', cause)
process.exit(-1)
}
console.log(
shouldCheck ?
'Checking for inconsistencies between templates and existing output files...'
:
'Generating output files from templates...'
)
Object.keys(templateMap).forEach(templateFilename => {
// Read the template
const templatePath = resolve(__dirname, templateFilename)
let templateText
try {
templateText = readFileSync(templatePath, 'utf8')
} catch (e) {
handleError(`Error reading template ${templatePath}`, e)
}
// Compile the template
let template
try {
template = doT.template(templateText)
} catch (e) {
handleError(`Error compiling template ${templatePath}`, e)
}
// Execute the template (generate the output)
let output
try {
output = template(colors)
} catch (e) {
handleError(`Error running template ${templatePath}`, e)
}
let outputPath = resolve(__dirname, templateMap[templateFilename])
try {
const existingOutput = readFileSync(outputPath, 'utf8')
// Only need to do something if the generated output differs from what's already on disk
if (output !== existingOutput) {
if (shouldCheck) { // Check generated output against existing output file
handleError(`Changes were made to ${templateMap[templateFilename]} that are inconsistent with its template (${templateFilename}).\nDo you need to [re]build?`)
} else { // Overwrite existing output file
try {
writeFileSync(outputPath, output, 'utf8')
} catch (e) {
handleError(`Error writing to output file ${outputPath}`, e)
}
}
}
} catch (e) {
handleError(`Error reading existing output file ${outputPath}`, e)
}
})
console.log('Success!')

2
build/doT.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
/* Laura Doktorova https://github.com/olado/doT */
!function(){"use strict";function e(n,t,r){return("string"==typeof t?t:t.toString()).replace(n.define||a,function(e,t,o,a){return 0===t.indexOf("def.")&&(t=t.substring(4)),t in r||(":"===o?(n.defineParams&&a.replace(n.defineParams,function(e,n,o){r[t]={arg:n,text:o}}),t in r||(r[t]=a)):new Function("def","def['"+t+"']="+a)(r)),""}).replace(n.use||a,function(t,o){n.useParams&&(o=o.replace(n.useParams,function(e,n,t,o){if(r[t]&&r[t].arg&&o){var a=(t+":"+o).replace(/'|\\/g,"_");return r.__exp=r.__exp||{},r.__exp[a]=r[t].text.replace(new RegExp("(^|[^\\w$])"+r[t].arg+"([^\\w$])","g"),"$1"+o+"$2"),n+"def.__exp['"+a+"']"}}));var a=new Function("def","return "+o)(r);return a?e(n,a,r):a})}function n(e){return e.replace(/\\('|\\)/g,"$1").replace(/[\r\t\n]/g," ")}var t,r={engine:"doT",version:"1.1.1",templateSettings:{evaluate:/\{\{([\s\S]+?(\}?)+)\}\}/g,interpolate:/\{\{=([\s\S]+?)\}\}/g,encode:/\{\{!([\s\S]+?)\}\}/g,use:/\{\{#([\s\S]+?)\}\}/g,useParams:/(^|[^\w$])def(?:\.|\[[\'\"])([\w$\.]+)(?:[\'\"]\])?\s*\:\s*([\w$\.]+|\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})/g,define:/\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,defineParams:/^\s*([\w$]+):([\s\S]+)/,conditional:/\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,iterate:/\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,varname:"it",strip:!0,append:!0,selfcontained:!1,doNotSkipEncoded:!1},template:void 0,compile:void 0,log:!0};r.encodeHTMLSource=function(e){var n={"&":"&#38;","<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","/":"&#47;"},t=e?/[&<>"'\/]/g:/&(?!#?\w+;)|<|>|"|'|\//g;return function(e){return e?e.toString().replace(t,function(e){return n[e]||e}):""}},t=function(){return this||(0,eval)("this")}(),"undefined"!=typeof module&&module.exports?module.exports=r:"function"==typeof define&&define.amd?define(function(){return r}):t.doT=r;var o={append:{start:"'+(",end:")+'",startencode:"'+encodeHTML("},split:{start:"';out+=(",end:");out+='",startencode:"';out+=encodeHTML("}},a=/$^/;r.template=function(c,i,u){i=i||r.templateSettings;var d,s,p=i.append?o.append:o.split,l=0,f=i.use||i.define?e(i,c,u||{}):c;f=("var out='"+(i.strip?f.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g," ").replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,""):f).replace(/'|\\/g,"\\$&").replace(i.interpolate||a,function(e,t){return p.start+n(t)+p.end}).replace(i.encode||a,function(e,t){return d=!0,p.startencode+n(t)+p.end}).replace(i.conditional||a,function(e,t,r){return t?r?"';}else if("+n(r)+"){out+='":"';}else{out+='":r?"';if("+n(r)+"){out+='":"';}out+='"}).replace(i.iterate||a,function(e,t,r,o){return t?(l+=1,s=o||"i"+l,t=n(t),"';var arr"+l+"="+t+";if(arr"+l+"){var "+r+","+s+"=-1,l"+l+"=arr"+l+".length-1;while("+s+"<l"+l+"){"+r+"=arr"+l+"["+s+"+=1];out+='"):"';} } out+='"}).replace(i.evaluate||a,function(e,t){return"';"+n(t)+"out+='"})+"';return out;").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/(\s|;|\}|^|\{)out\+='';/g,"$1").replace(/\+''/g,""),d&&(i.selfcontained||!t||t._encodeHTML||(t._encodeHTML=r.encodeHTMLSource(i.doNotSkipEncoded)),f="var encodeHTML = typeof _encodeHTML !== 'undefined' ? _encodeHTML : ("+r.encodeHTMLSource.toString()+"("+(i.doNotSkipEncoded||"")+"));"+f);try{return new Function(i.varname,f)}catch(e){throw"undefined"!=typeof console&&console.log("Could not create a template function: "+f),e}},r.compile=function(e,n){return r.template(e,null,n)}}();

28
build/package.json Normal file
View File

@@ -0,0 +1,28 @@
{
"name": "onedark.vim-builder",
"version": "1.0.0",
"description": "Builds the onedark.vim Vim colorscheme and associated files",
"main": "build.js",
"scripts": {
"build": "node build.js",
"precommit": "npm test",
"test": "eslint build.js && node build.js check"
},
"author": {
"name": "Josh Dick",
"email": "josh@joshdick.net",
"url": "http://joshdick.net"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/joshdick/onedark.vim.git"
},
"devDependencies": {
"eslint": "^3.15.0",
"husky": "^0.13.1"
},
"dependencies": {
"dot": "^1.1.1"
}
}

View File

@@ -0,0 +1,109 @@
" [onedark.vim](https://github.com/joshdick/onedark.vim/)
" This is a [vim-airline](https://github.com/vim-airline/vim-airline) theme for use with
" the [onedark.vim](https://github.com/joshdick/onedark.vim) colorscheme.
" It is based on vim-airline's ["tomorrow" theme](https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/tomorrow.vim).
function! airline#themes#onedark#refresh()
let g:airline#themes#onedark#palette = {}
let g:airline#themes#onedark#palette.accents = {
\ 'red': [ '{{=it.red.gui}}', '', {{=it.red.cterm}}, 0 ]
\ }
let s:N1 = [ '{{=it.black.gui}}', '{{=it.green.gui}}', {{=it.black.cterm}}, {{=it.green.cterm}} ]
let s:N2 = [ '{{=it.white.gui}}', '{{=it.visual_grey.gui}}', {{=it.white.cterm}}, {{=it.visual_grey.cterm}} ]
let s:N3 = [ '{{=it.green.gui}}', '{{=it.black.gui}}', {{=it.green.cterm}}, {{=it.black.cterm}} ]
let g:airline#themes#onedark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let group = airline#themes#get_highlight('vimCommand')
let g:airline#themes#onedark#palette.normal_modified = {
\ 'airline_c': [ group[0], '', group[2], '', '' ]
\ }
let s:I1 = [ '{{=it.black.gui}}', '{{=it.blue.gui}}', {{=it.black.cterm}}, {{=it.blue.cterm}} ]
let s:I2 = s:N2
let s:I3 = [ '{{=it.blue.gui}}', '{{=it.black.gui}}', {{=it.blue.cterm}}, {{=it.black.cterm}} ]
let g:airline#themes#onedark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#onedark#palette.insert_modified = g:airline#themes#onedark#palette.normal_modified
let s:R1 = [ '{{=it.black.gui}}', '{{=it.red.gui}}', {{=it.black.cterm}}, {{=it.red.cterm}} ]
let s:R2 = s:N2
let s:R3 = [ '{{=it.red.gui}}', '{{=it.black.gui}}', {{=it.red.cterm}}, {{=it.black.cterm}} ]
let g:airline#themes#onedark#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
let g:airline#themes#onedark#palette.replace_modified = g:airline#themes#onedark#palette.normal_modified
let s:V1 = [ '{{=it.black.gui}}', '{{=it.purple.gui}}', {{=it.black.cterm}}, {{=it.purple.cterm}} ]
let s:V2 = s:N2
let s:V3 = [ '{{=it.purple.gui}}', '{{=it.black.gui}}', {{=it.purple.cterm}}, {{=it.black.cterm}} ]
let g:airline#themes#onedark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#onedark#palette.visual_modified = g:airline#themes#onedark#palette.normal_modified
let s:IA1 = [ '{{=it.black.gui}}', '{{=it.white.gui}}', {{=it.black.cterm}}, {{=it.white.cterm}} ]
let s:IA2 = [ '{{=it.white.gui}}', '{{=it.visual_grey.gui}}', {{=it.white.cterm}}, {{=it.visual_grey.cterm}} ]
let s:IA3 = s:N2
let g:airline#themes#onedark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
let g:airline#themes#onedark#palette.inactive_modified = {
\ 'airline_c': [ group[0], '', group[2], '', '' ]
\ }
" Warning/Error styling code from vim-airline's ["base16" theme](https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/base16.vim)
" Warnings
let s:WI = [ '{{=it.black.gui}}', '{{=it.yellow.gui}}', {{=it.black.cterm}}, {{=it.yellow.cterm}} ]
let g:airline#themes#onedark#palette.normal.airline_warning = [
\ s:WI[0], s:WI[1], s:WI[2], s:WI[3]
\ ]
let g:airline#themes#onedark#palette.normal_modified.airline_warning =
\ g:airline#themes#onedark#palette.normal.airline_warning
let g:airline#themes#onedark#palette.insert.airline_warning =
\ g:airline#themes#onedark#palette.normal.airline_warning
let g:airline#themes#onedark#palette.insert_modified.airline_warning =
\ g:airline#themes#onedark#palette.normal.airline_warning
let g:airline#themes#onedark#palette.visual.airline_warning =
\ g:airline#themes#onedark#palette.normal.airline_warning
let g:airline#themes#onedark#palette.visual_modified.airline_warning =
\ g:airline#themes#onedark#palette.normal.airline_warning
let g:airline#themes#onedark#palette.replace.airline_warning =
\ g:airline#themes#onedark#palette.normal.airline_warning
let g:airline#themes#onedark#palette.replace_modified.airline_warning =
\ g:airline#themes#onedark#palette.normal.airline_warning
" Errors
let s:ER = [ '{{=it.black.gui}}', '{{=it.red.gui}}', {{=it.black.cterm}}, {{=it.red.cterm}} ]
let g:airline#themes#onedark#palette.normal.airline_error = [
\ s:ER[0], s:ER[1], s:ER[2], s:ER[3]
\ ]
let g:airline#themes#onedark#palette.normal_modified.airline_error =
\ g:airline#themes#onedark#palette.normal.airline_error
let g:airline#themes#onedark#palette.insert.airline_error =
\ g:airline#themes#onedark#palette.normal.airline_error
let g:airline#themes#onedark#palette.insert_modified.airline_error =
\ g:airline#themes#onedark#palette.normal.airline_error
let g:airline#themes#onedark#palette.visual.airline_error =
\ g:airline#themes#onedark#palette.normal.airline_error
let g:airline#themes#onedark#palette.visual_modified.airline_error =
\ g:airline#themes#onedark#palette.normal.airline_error
let g:airline#themes#onedark#palette.replace.airline_error =
\ g:airline#themes#onedark#palette.normal.airline_error
let g:airline#themes#onedark#palette.replace_modified.airline_error =
\ g:airline#themes#onedark#palette.normal.airline_error
endfunction
call airline#themes#onedark#refresh()

View File

@@ -0,0 +1,36 @@
" [onedark.vim](https://github.com/joshdick/onedark.vim/)
" This is a [lightline.vim](https://github.com/itchyny/lightline.vim) colorscheme for use with
" the [onedark.vim](https://github.com/joshdick/onedark.vim) colorscheme.
let s:black = [ '{{=it.black.gui}}', {{=it.black.cterm}} ]
let s:blue = [ '{{=it.blue.gui}}', {{=it.blue.cterm}} ]
let s:green = [ '{{=it.green.gui}}', {{=it.green.cterm}} ]
let s:grey = [ '{{=it.visual_grey.gui}}', {{=it.visual_grey.cterm}} ]
let s:purple = [ '{{=it.purple.gui}}', {{=it.purple.cterm}} ]
let s:red = [ '{{=it.red.gui}}', {{=it.red.cterm}} ]
let s:white = [ '{{=it.white.gui}}', {{=it.white.cterm}} ]
let s:yellow = [ '{{=it.yellow.gui}}', {{=it.yellow.cterm}} ]
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ s:black, s:green ], [ s:white, s:grey ] ]
let s:p.normal.right = [ [ s:black, s:green ], [ s:white, s:grey ] ]
let s:p.inactive.left = [ [ s:white, s:grey ], [ s:white, s:grey ] ]
let s:p.inactive.right = [ [ s:black, s:white ], [ s:black, s:white ] ]
let s:p.insert.left = [ [ s:black, s:blue ], [ s:white, s:grey ] ]
let s:p.insert.right = [ [ s:black, s:blue ], [ s:white, s:grey ] ]
let s:p.replace.left = [ [ s:black, s:red ], [ s:white, s:grey ] ]
let s:p.replace.right = [ [ s:black, s:red ], [ s:white, s:grey ] ]
let s:p.visual.left = [ [ s:black, s:purple ], [ s:white, s:grey ] ]
let s:p.visual.right = [ [ s:black, s:purple ], [ s:white, s:grey ] ]
let s:p.normal.middle = [ [ s:white, s:black ] ]
let s:p.inactive.middle = [ [ s:white, s:grey ] ]
let s:p.tabline.left = [ [ s:white, s:grey ] ]
let s:p.tabline.tabsel = [ [ s:black, s:white ] ]
let s:p.tabline.middle = [ [ s:white, s:black ] ]
let s:p.tabline.right = [ [ s:white, s:grey ] ]
let s:p.normal.error = [ [ s:black, s:red ] ]
let s:p.normal.warning = [ [ s:black, s:yellow ] ]
let g:lightline#colorscheme#onedark#palette = lightline#colorscheme#flatten(s:p)

View File

@@ -0,0 +1,494 @@
" Vim Color File
" Name: onedark.vim
" Maintainer: https://github.com/joshdick/onedark.vim/
" License: The MIT License (MIT)
" Based On: https://github.com/MaxSt/FlatColor/
" A companion [vim-airline](https://github.com/bling/vim-airline) theme is available at: https://github.com/joshdick/airline-onedark.vim
" +-----------------+
" | Color Reference |
" +-----------------+
" The following colors were measured inside Atom using its built-in inspector.
" +---------------------------------------------+
" | Color Name | RGB | Hex |
" |--------------+--------------------+---------|
" | Black | rgb(40, 44, 52) | #282c34 |
" |--------------+--------------------+---------|
" | White | rgb(171, 178, 191) | #abb2bf |
" |--------------+--------------------+---------|
" | Light Red | rgb(224, 108, 117) | #e06c75 |
" |--------------+--------------------+---------|
" | Dark Red | rgb(190, 80, 70) | #be5046 |
" |--------------+--------------------+---------|
" | Green | rgb(152, 195, 121) | #98c379 |
" |--------------+--------------------+---------|
" | Light Yellow | rgb(229, 192, 123) | #e5c07b |
" |--------------+--------------------+---------|
" | Dark Yellow | rgb(209, 154, 102) | #d19a66 |
" |--------------+--------------------+---------|
" | Blue | rgb(97, 175, 239) | #61afef |
" |--------------+--------------------+---------|
" | Magenta | rgb(198, 120, 221) | #c678dd |
" |--------------+--------------------+---------|
" | Cyan | rgb(86, 182, 194) | #56b6c2 |
" |--------------+--------------------+---------|
" | Gutter Grey | rgb(99, 109, 131) | #636d83 |
" |--------------+--------------------+---------|
" | Comment Grey | rgb(92, 99, 112) | #5c6370 |
" +---------------------------------------------+
" +----------------+
" | Initialization |
" +----------------+
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
set t_Co=256
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 color scheme is available; see
" < https://github.com/joshdick/onedark.vim/blob/master/README.md >
" for more information.)
if !exists("g:onedark_termcolors")
let g:onedark_termcolors = 256
endif
" Not 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 is based on one from FlatColor: https://github.com/MaxSt/FlatColor/
" Which in turn was based on one found in hemisu: https://github.com/noahfrederick/vim-hemisu/
function! s:h(group, style)
if g:onedark_terminal_italics == 0
if has_key(a:style, "cterm") && a:style["cterm"] == "italic"
unlet a:style.cterm
endif
if has_key(a:style, "gui") && a:style["gui"] == "italic"
unlet a:style.gui
endif
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")
endif
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
" public
function! onedark#set_highlight(group, style)
call s:h(a:group, a:style)
endfunction
" /public
" +-----------------+
" | Color Variables |
" +-----------------+
let s:red = { "gui": "{{=it.red.gui}}", "cterm": "{{=it.red.cterm}}", "cterm16": "{{=it.red.cterm16}}" }
let s:dark_red = { "gui": "{{=it.dark_red.gui}}", "cterm": "{{=it.dark_red.cterm}}", "cterm16": "{{=it.dark_red.cterm16}}" }
let s:green = { "gui": "{{=it.green.gui}}", "cterm": "{{=it.green.cterm}}", "cterm16": "{{=it.green.cterm16}}" }
let s:yellow = { "gui": "{{=it.yellow.gui}}", "cterm": "{{=it.yellow.cterm}}", "cterm16": "{{=it.yellow.cterm16}}" }
let s:dark_yellow = { "gui": "{{=it.dark_yellow.gui}}", "cterm": "{{=it.dark_yellow.cterm}}", "cterm16": "{{=it.dark_yellow.cterm16}}" }
let s:blue = { "gui": "{{=it.blue.gui}}", "cterm": "{{=it.blue.cterm}}", "cterm16": "{{=it.blue.cterm16}}" }
let s:purple = { "gui": "{{=it.purple.gui}}", "cterm": "{{=it.purple.cterm}}", "cterm16": "{{=it.purple.cterm16}}" }
let s:cyan = { "gui": "{{=it.cyan.gui}}", "cterm": "{{=it.cyan.cterm}}", "cterm16": "{{=it.cyan.cterm16}}" }
let s:white = { "gui": "{{=it.white.gui}}", "cterm": "{{=it.white.cterm}}", "cterm16": "{{=it.white.cterm16}}" }
let s:black = { "gui": "{{=it.black.gui}}", "cterm": "{{=it.black.cterm}}", "cterm16": "{{=it.black.cterm16}}" }
let s:visual_black = { "gui": "NONE", "cterm": "NONE", "cterm16": s:black.cterm16 } " Black out selected text in 16-color visual mode
let s:comment_grey = { "gui": "{{=it.comment_grey.gui}}", "cterm": "{{=it.comment_grey.cterm}}", "cterm16": "{{=it.comment_grey.cterm16}}" }
let s:gutter_fg_grey = { "gui": "{{=it.gutter_fg_grey.gui}}", "cterm": "{{=it.gutter_fg_grey.cterm}}", "cterm16": "{{=it.gutter_fg_grey.cterm16}}" }
let s:cursor_grey = { "gui": "{{=it.cursor_grey.gui}}", "cterm": "{{=it.cursor_grey.cterm}}", "cterm16": "{{=it.cursor_grey.cterm16}}" }
let s:visual_grey = { "gui": "{{=it.visual_grey.gui}}", "cterm": "{{=it.visual_grey.cterm}}", "cterm16": "{{=it.visual_grey.cterm16}}" }
let s:menu_grey = { "gui": s:visual_grey.gui, "cterm": s:visual_grey.cterm, "cterm16": "{{=it.menu_grey.cterm16}}" }
let s:special_grey = { "gui": "{{=it.special_grey.gui}}", "cterm": "{{=it.special_grey.cterm}}", "cterm16": "{{=it.special_grey.cterm16}}" }
let s:vertsplit = { "gui": "{{=it.vertsplit.gui}}", "cterm": "{{=it.vertsplit.cterm}}", "cterm16": "{{=it.vertsplit.cterm16}}" }
" +---------------------------------------------------------+
" | 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", { "fg": s:cyan }) " 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", { "fg": s:blue }) " 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", { "fg": s:purple }) " 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", { "fg": s:blue }) " preprocessor #include
call s:h("Define", { "fg": s:purple }) " preprocessor #define
call s:h("Macro", { "fg": s:purple }) " same as Define
call s:h("PreCondit", { "fg": s:yellow }) " preprocessor #if, #else, #endif, etc.
call s:h("Type", { "fg": s:yellow }) " int, long, char, etc.
call s:h("StorageClass", { "fg": s:yellow }) " static, register, volatile, etc.
call s:h("Structure", { "fg": s:yellow }) " struct, union, enum, etc.
call s:h("Typedef", { "fg": s:yellow }) " 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 }) " 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", { "fg": s:blue }) " directory names (and other special names in listings)
call s:h("DiffAdd", { "bg": s:visual_grey}) " diff mode: Added line
call s:h("DiffChange", { "bg": s:visual_grey }) " diff mode: Changed line
call s:h("DiffDelete", { "fg": s:red }) " diff mode: Deleted line
call s:h("DiffText", { "bg": s:visual_grey, "fg": s:yellow }) " diff mode: Changed text within a changed line
call s:h("ErrorMsg", { "fg": s:red }) " error messages on the command line
call s:h("VertSplit", { "fg": s:vertsplit }) " the column separating vertically split windows
call s:h("Folded", { "fg": s:comment_grey }) " line used for closed folds
call s:h("FoldColumn", {}) " 'foldcolumn'
call s:h("SignColumn", {}) " column where signs are displayed
call s:h("IncSearch", { "fg": s:black, "bg": s:yellow }) " 'incsearch' highlighting; also used for the text replaced with ":s///c"
call s:h("LineNr", { "fg": s:gutter_fg_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", { "fg": s:blue, "gui": "underline" }) " 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", { "bg": s:menu_grey }) " Popup menu: normal item.
call s:h("PmenuSel", { "fg": s:black, "bg": s:blue }) " Popup menu: selected item.
call s:h("PmenuSbar", { "bg": s:special_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", { "fg": s:black, "bg": s:yellow }) " 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, "gui": "underline", "cterm": "underline" }) " 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, "bg": s:cursor_grey }) " 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", { "fg": s:comment_grey }) " tab pages line, not active tab page label
call s:h("TabLineFill", {}) " tab pages line, where there are no labels
call s:h("TabLineSel", { "fg": s:white }) " 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", { "fg": s:visual_black, "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:yellow }) " warning messages
call s:h("WildMenu", { "fg": s:black, "bg": s:blue }) " current match in 'wildmenu' completion
" +--------------------------------+
" | Language-Specific Highlighting |
" +--------------------------------+
" CSS
call s:h("cssAttrComma", { "fg": s:purple })
call s:h("cssAttributeSelector", { "fg": s:green })
call s:h("cssBraces", { "fg": s:white })
call s:h("cssClassName", { "fg": s:dark_yellow })
call s:h("cssClassNameDot", { "fg": s:dark_yellow })
call s:h("cssDefinition", { "fg": s:purple })
call s:h("cssFontAttr", { "fg": s:dark_yellow })
call s:h("cssFontDescriptor", { "fg": s:purple })
call s:h("cssFunctionName", { "fg": s:blue })
call s:h("cssIdentifier", { "fg": s:blue })
call s:h("cssImportant", { "fg": s:purple })
call s:h("cssInclude", { "fg": s:white })
call s:h("cssIncludeKeyword", { "fg": s:purple })
call s:h("cssMediaType", { "fg": s:dark_yellow })
call s:h("cssProp", { "fg": s:white })
call s:h("cssPseudoClassId", { "fg": s:dark_yellow })
call s:h("cssSelectorOp", { "fg": s:purple })
call s:h("cssSelectorOp2", { "fg": s:purple })
call s:h("cssTagName", { "fg": s:red })
" HTML
call s:h("htmlTitle", { "fg": s:white })
call s:h("htmlArg", { "fg": s:dark_yellow })
call s:h("htmlEndTag", { "fg": s:white })
call s:h("htmlH1", { "fg": s:white })
call s:h("htmlLink", { "fg": s:purple })
call s:h("htmlSpecialChar", { "fg": s:dark_yellow })
call s:h("htmlSpecialTagName", { "fg": s:red })
call s:h("htmlTag", { "fg": s:white })
call s:h("htmlTagName", { "fg": s:red })
" JavaScript
call s:h("javaScriptBraces", { "fg": s:white })
call s:h("javaScriptFunction", { "fg": s:purple })
call s:h("javaScriptIdentifier", { "fg": s:purple })
call s:h("javaScriptNull", { "fg": s:dark_yellow })
call s:h("javaScriptNumber", { "fg": s:dark_yellow })
call s:h("javaScriptRequire", { "fg": s:cyan })
call s:h("javaScriptReserved", { "fg": s:purple })
" https://github.com/pangloss/vim-javascript
call s:h("jsArrowFunction", { "fg": s:purple })
call s:h("jsClassKeyword", { "fg": s:purple })
call s:h("jsClassMethodType", { "fg": s:purple })
call s:h("jsDocParam", { "fg": s:blue })
call s:h("jsDocTags", { "fg": s:purple })
call s:h("jsExport", { "fg": s:purple })
call s:h("jsExportDefault", { "fg": s:purple })
call s:h("jsExtendsKeyword", { "fg": s:purple })
call s:h("jsFrom", { "fg": s:purple })
call s:h("jsFuncCall", { "fg": s:blue })
call s:h("jsFunction", { "fg": s:purple })
call s:h("jsGlobalObjects", { "fg": s:yellow })
call s:h("jsImport", { "fg": s:purple })
call s:h("jsModuleAs", { "fg": s:purple })
call s:h("jsModuleWords", { "fg": s:purple })
call s:h("jsModules", { "fg": s:purple })
call s:h("jsNull", { "fg": s:dark_yellow })
call s:h("jsOperator", { "fg": s:purple })
call s:h("jsStorageClass", { "fg": s:purple })
call s:h("jsSuper", { "fg": s:red })
call s:h("jsTemplateBraces", { "fg": s:dark_red })
call s:h("jsTemplateVar", { "fg": s:green })
call s:h("jsThis", { "fg": s:red })
call s:h("jsUndefined", { "fg": s:dark_yellow })
" https://github.com/othree/yajs.vim
call s:h("javascriptArrowFunc", { "fg": s:purple })
call s:h("javascriptClassExtends", { "fg": s:purple })
call s:h("javascriptClassKeyword", { "fg": s:purple })
call s:h("javascriptDocNotation", { "fg": s:purple })
call s:h("javascriptDocParamName", { "fg": s:blue })
call s:h("javascriptDocTags", { "fg": s:purple })
call s:h("javascriptEndColons", { "fg": s:white })
call s:h("javascriptExport", { "fg": s:purple })
call s:h("javascriptFuncArg", { "fg": s:white })
call s:h("javascriptFuncKeyword", { "fg": s:purple })
call s:h("javascriptIdentifier", { "fg": s:red })
call s:h("javascriptImport", { "fg": s:purple })
call s:h("javascriptMethodName", { "fg": s:white })
call s:h("javascriptObjectLabel", { "fg": s:white })
call s:h("javascriptOpSymbol", { "fg": s:cyan })
call s:h("javascriptOpSymbols", { "fg": s:cyan })
call s:h("javascriptPropertyName", { "fg": s:green })
call s:h("javascriptTemplateSB", { "fg": s:dark_red })
call s:h("javascriptVariable", { "fg": s:purple })
" JSON
call s:h("jsonCommentError", { "fg": s:white })
call s:h("jsonKeyword", { "fg": s:red })
call s:h("jsonBoolean", { "fg": s:dark_yellow })
call s:h("jsonNumber", { "fg": s:dark_yellow })
call s:h("jsonQuote", { "fg": s:white })
call s:h("jsonMissingCommaError", { "fg": s:red, "gui": "reverse" })
call s:h("jsonNoQuotesError", { "fg": s:red, "gui": "reverse" })
call s:h("jsonNumError", { "fg": s:red, "gui": "reverse" })
call s:h("jsonString", { "fg": s:green })
call s:h("jsonStringSQError", { "fg": s:red, "gui": "reverse" })
call s:h("jsonSemicolonError", { "fg": s:red, "gui": "reverse" })
" Markdown
call s:h("markdownCode", { "fg": s:green })
call s:h("markdownCodeBlock", { "fg": s:green })
call s:h("markdownCodeDelimiter", { "fg": s:green })
call s:h("markdownHeadingDelimiter", { "fg": s:red })
call s:h("markdownRule", { "fg": s:comment_grey })
call s:h("markdownHeadingRule", { "fg": s:comment_grey })
call s:h("markdownH1", { "fg": s:red })
call s:h("markdownH2", { "fg": s:red })
call s:h("markdownH3", { "fg": s:red })
call s:h("markdownH4", { "fg": s:red })
call s:h("markdownH5", { "fg": s:red })
call s:h("markdownH6", { "fg": s:red })
call s:h("markdownIdDelimiter", { "fg": s:purple })
call s:h("markdownId", { "fg": s:purple })
call s:h("markdownBlockquote", { "fg": s:comment_grey })
call s:h("markdownItalic", { "fg": s:purple, "gui": "italic", "cterm": "italic" })
call s:h("markdownBold", { "fg": s:dark_yellow, "gui": "bold", "cterm": "bold" })
call s:h("markdownListMarker", { "fg": s:red })
call s:h("markdownOrderedListMarker", { "fg": s:red })
call s:h("markdownIdDeclaration", { "fg": s:blue })
call s:h("markdownLinkText", { "fg": s:blue })
call s:h("markdownLinkDelimiter", { "fg": s:white })
call s:h("markdownUrl", { "fg": s:purple })
" PHP
call s:h("phpVarSelector", { "fg": s:red })
call s:h("phpOperator", { "fg": s:white })
call s:h("phpParent", { "fg": s:white })
call s:h("phpMemberSelector", { "fg": s:white })
call s:h("phpType", { "fg": s:purple })
call s:h("phpKeyword", { "fg": s:purple })
call s:h("phpClass", { "fg": s:yellow })
call s:h("phpUseClass", { "fg": s:white })
call s:h("phpUseAlias", { "fg": s:white })
call s:h("phpInclude", { "fg": s:purple })
call s:h("phpClassExtends", { "fg": s:green })
call s:h("phpDocTags", { "fg": s:white })
call s:h("phpFunction", { "fg": s:blue })
call s:h("phpFunctions", { "fg": s:cyan })
call s:h("phpMethodsVar", { "fg": s:dark_yellow })
call s:h("phpMagicConstants", { "fg": s:dark_yellow })
call s:h("phpSuperglobals", { "fg": s:red })
call s:h("phpConstants", { "fg": s:dark_yellow })
" Ruby
call s:h("rubyBlockParameter", { "fg": s:red})
call s:h("rubyBlockParameterList", { "fg": s:red })
call s:h("rubyClass", { "fg": s:purple})
call s:h("rubyConstant", { "fg": s:yellow})
call s:h("rubyControl", { "fg": s:purple })
call s:h("rubyEscape", { "fg": s:red})
call s:h("rubyFunction", { "fg": s:blue})
call s:h("rubyGlobalVariable", { "fg": s:red})
call s:h("rubyInclude", { "fg": s:blue})
call s:h("rubyIncluderubyGlobalVariable", { "fg": s:red})
call s:h("rubyInstanceVariable", { "fg": s:red})
call s:h("rubyInterpolation", { "fg": s:cyan })
call s:h("rubyInterpolationDelimiter", { "fg": s:red })
call s:h("rubyInterpolationDelimiter", { "fg": s:red})
call s:h("rubyRegexp", { "fg": s:cyan})
call s:h("rubyRegexpDelimiter", { "fg": s:cyan})
call s:h("rubyStringDelimiter", { "fg": s:green})
call s:h("rubySymbol", { "fg": s:cyan})
" Sass
call s:h("sassAmpersand", { "fg": s:red })
call s:h("sassClass", { "fg": s:dark_yellow })
call s:h("sassControl", { "fg": s:purple })
call s:h("sassExtend", { "fg": s:purple })
call s:h("sassFor", { "fg": s:white })
call s:h("sassFunction", { "fg": s:cyan })
call s:h("sassId", { "fg": s:blue })
call s:h("sassInclude", { "fg": s:purple })
call s:h("sassMedia", { "fg": s:purple })
call s:h("sassMediaOperators", { "fg": s:white })
call s:h("sassMixin", { "fg": s:purple })
call s:h("sassMixinName", { "fg": s:blue })
call s:h("sassMixing", { "fg": s:purple })
" TypeScript
call s:h("typescriptReserved", { "fg": s:purple })
call s:h("typescriptEndColons", { "fg": s:white })
call s:h("typescriptBraces", { "fg": s:white })
" XML
call s:h("xmlAttrib", { "fg": s:dark_yellow })
call s:h("xmlEndTag", { "fg": s:red })
call s:h("xmlTag", { "fg": s:red })
call s:h("xmlTagName", { "fg": s:red })
" +---------------------+
" | Plugin Highlighting |
" +---------------------+
" airblade/vim-gitgutter
hi link GitGutterAdd SignifySignAdd
hi link GitGutterChange SignifySignChange
hi link GitGutterDelete SignifySignDelete
" mhinz/vim-signify
call s:h("SignifySignAdd", { "fg": s:green })
call s:h("SignifySignChange", { "fg": s:yellow })
call s:h("SignifySignDelete", { "fg": s:red })
" neomake/neomake
call s:h("NeomakeWarningSign", { "fg": s:yellow })
call s:h("NeomakeErrorSign", { "fg": s:red })
call s:h("NeomakeInfoSign", { "fg": s:blue })
" tpope/vim-fugitive
call s:h("diffAdded", { "fg": s:green })
call s:h("diffRemoved", { "fg": s:red })
" +------------------+
" | Git Highlighting |
" +------------------+
call s:h("gitcommitComment", { "fg": s:comment_grey })
call s:h("gitcommitUnmerged", { "fg": s:green })
call s:h("gitcommitOnBranch", {})
call s:h("gitcommitBranch", { "fg": s:purple })
call s:h("gitcommitDiscardedType", { "fg": s:red })
call s:h("gitcommitSelectedType", { "fg": s:green })
call s:h("gitcommitHeader", {})
call s:h("gitcommitUntrackedFile", { "fg": s:cyan })
call s:h("gitcommitDiscardedFile", { "fg": s:red })
call s:h("gitcommitSelectedFile", { "fg": s:green })
call s:h("gitcommitUnmergedFile", { "fg": s:yellow })
call s:h("gitcommitFile", {})
hi link gitcommitNoBranch gitcommitBranch
hi link gitcommitUntracked gitcommitComment
hi link gitcommitDiscarded gitcommitComment
hi link gitcommitSelected gitcommitComment
hi link gitcommitDiscardedArrow gitcommitDiscardedFile
hi link gitcommitSelectedArrow gitcommitSelectedFile
hi link gitcommitUnmergedArrow gitcommitUnmergedFile
" +------------------------+
" | Neovim terminal colors |
" +------------------------+
if has("nvim")
let g:terminal_color_0 = s:black.gui
let g:terminal_color_1 = s:red.gui
let g:terminal_color_2 = s:green.gui
let g:terminal_color_3 = s:yellow.gui
let g:terminal_color_4 = s:blue.gui
let g:terminal_color_5 = s:purple.gui
let g:terminal_color_6 = s:cyan.gui
let g:terminal_color_7 = s:white.gui
let g:terminal_color_8 = s:visual_grey.gui
let g:terminal_color_9 = s:dark_red.gui
let g:terminal_color_10 = s:green.gui " No dark version
let g:terminal_color_11 = s:dark_yellow.gui
let g:terminal_color_12 = s:blue.gui " No dark version
let g:terminal_color_13 = s:purple.gui " No dark version
let g:terminal_color_14 = s:cyan.gui " No dark version
let g:terminal_color_15 = s:comment_grey.gui
let g:terminal_color_background = g:terminal_color_0
let g:terminal_color_foreground = g:terminal_color_7
endif

View File

@@ -98,19 +98,19 @@ function! s:h(group, style)
\ "cterm=" (has_key(a:style, "cterm") ? a:style.cterm : "NONE")
endfunction
"public {{
" public
function! onedark#set_highlight(group, style)
call s:h(a:group, a:style)
endfunction
"public end }}
" /public
" +-----------------+
" | Color Variables |
" +-----------------+
let s:red = { "gui": "#E06C75", "cterm": "204", "cterm16": "1" } " Alternate cterm: 168
let s:red = { "gui": "#E06C75", "cterm": "204", "cterm16": "1" }
let s:dark_red = { "gui": "#BE5046", "cterm": "196", "cterm16": "9" }
let s:green = { "gui": "#98C379", "cterm": "114", "cterm16": "2" }
@@ -118,20 +118,20 @@ let s:green = { "gui": "#98C379", "cterm": "114", "cterm16": "2" }
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:blue = { "gui": "#61AFEF", "cterm": "39", "cterm16": "4" }
let s:purple = { "gui": "#C678DD", "cterm": "170", "cterm16": "5" } " Alternate cterm: 176
let s:purple = { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }
let s:cyan = { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" } " Alternate cterm: 73
let s:cyan = { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" }
let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16" : "7" }
let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16": "7" }
let s:black = { "gui": "#282C34", "cterm": "235", "cterm16": "0" }
let s:visual_black = { "gui": "NONE", "cterm": "NONE", "cterm16": s:black.cterm16 } " Black out selected text in 16-color visual mode
let s:comment_grey = { "gui": "#5C6370", "cterm": "59", "cterm16": "15" }
let s:gutter_fg_grey = { "gui": "#636D83", "cterm": "238", "cterm16": "15" }
let s:cursor_grey = { "gui": "#2C323C", "cterm": "236", "cterm16": "8" }
let s:cursor_grey = { "gui": "#2C323C", "cterm": "236", "cterm16": "8" }
let s:visual_grey = { "gui": "#3E4452", "cterm": "237", "cterm16": "15" }
let s:menu_grey = { "gui": s:visual_grey.gui, "cterm": s:visual_grey.cterm, "cterm16": "8" }
let s:special_grey = { "gui": "#3B4048", "cterm": "238", "cterm16": "15" }