Skip to content

Commit

Permalink
lightline scheme & refactor all the mono colors
Browse files Browse the repository at this point in the history
  • Loading branch information
cormacrelf committed Oct 17, 2018
1 parent 0bb3815 commit 1848e9b
Show file tree
Hide file tree
Showing 7 changed files with 325 additions and 90 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.swp
*.swo
.DS_Store
doc/tags
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ I wasn't happy with [endel/vim-github-colorscheme](https://github.com/endel/vim-

It degrades gracefully in non-gui mode (ie ctermbg/ctermfg/256colors).

It supports the following **plugins**:
[airline](https://github.com/vim-airline/vim-airline),
[lightline](https://github.com/vim-airline/lightline),
[fzf](https://github.com/junegunn/fzf),
[GitGutter](https://github.com/airblade/vim-gitgutter),
[NERDTree](https://github.com/scrooloose/nerdtree),
[Startify](https://github.com/mhinz/vim-startify),
[sneak](https://github.com/justinmk/vim-sneak).

Extra tuning has been done for the following **languages**:
VimL, Diff, C, Rust, Go (`fatih/vim-go`), Haskell
(`neovimhaskell/haskell-vim`),
Ruby, Python, Html, Xml, Toml, Yaml, Typescript. Though be aware, GitHub
doesn't use many colors, so tuning is minimal.


## Install

Install with your favourite plugin manager. For vim-plug:
Expand All @@ -20,8 +36,9 @@ Then set your colorscheme to 'github':
" in your .vimrc or init.vim
colorscheme github
" if you use airline
" if you use airline / lightline
let g:airline_theme = "github"
let g:lightline = { 'colorscheme': 'github' }
```

## Options
Expand All @@ -32,12 +49,12 @@ Place **before** the `colorscheme github`:
" use a slightly darker background, like GitHub inline code blocks
let g:github_colors_soft = 1
" default is to extend a few languages' syntaxes to highlight function calls
" (eg c). use this to disable that.
let g:github_colors_extra_functions = 0
" more blocky diff markers in signcolumn (e.g. GitGutter)
let g:github_colors_block_diffmark = 0
:help github_colors.txt
```

## Screenshots

### Rust

Expand Down
13 changes: 13 additions & 0 deletions autoload/github_colors.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
func! github_colors#toggle_soft()
if g:github_colors_soft == 0
let g:github_colors_soft = 1
else
let g:github_colors_soft = 0
endif
colors github
" call lightline#colorscheme#github#refresh()
let g:lightline#colorscheme#github#palette = lightline#colorscheme#github#compute()
call lightline#init()
call lightline#colorscheme()
call lightline#update()
endfunc
77 changes: 77 additions & 0 deletions autoload/lightline/colorscheme/github.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
" vim:foldmethod=marker:foldlevel=0:foldenable:
" -----------------------------------------------------------------------------
" Description: GitHub colorscheme for Lightline (itchyny/lightline.vim)
" Author: Cormac Relf <[email protected]>
" Source: Originally adapted from http//github.com/morhetz/gruvbox
" -----------------------------------------------------------------------------

" {{{ color getter fns
func! s:getGHColor(group)
let guiColor = synIDattr(hlID(a:group), "fg", "gui")
let termColor = synIDattr(hlID(a:group), "fg", "cterm")
return [ guiColor, termColor ]
endfunc
"}}}

func! lightline#colorscheme#github#compute()
if exists('g:lightline')
" import colors from scheme {{{
let s:base0 = s:getGHColor('ghBase0')
let s:base1 = s:getGHColor('ghBase1')
let s:base3 = s:getGHColor('ghBase3')
let s:base4 = s:getGHColor('ghBase4')
let s:grey0 = s:getGHColor('ghGrey0')
let s:grey1 = s:getGHColor('ghGrey1')
let s:grey2 = s:getGHColor('ghGrey2')
let s:background = s:getGHColor('ghBackground')

let s:yellow = s:getGHColor('ghYellow')
let s:blue = s:getGHColor('ghBlue')
let s:darkblue = s:getGHColor('ghDarkBlue')
let s:blue2 = s:getGHColor('ghBlue2')
let s:blue3 = s:getGHColor('ghBlue3')
let s:blue4 = s:getGHColor('ghBlue4')
let s:red = s:getGHColor('ghRed')
let s:darkred = s:getGHColor('ghDarkRed')
let s:orange = s:getGHColor('ghOrange')
let s:purple = s:getGHColor('ghPurple')
" }}}

let s:flatten = [ s:base0, s:grey0 ]
let s:below = [ s:base1, s:grey2 ]

let s:p = {'normal':{}, 'inactive':{}, 'insert':{}, 'replace':{}, 'visual':{}, 'tabline':{}, 'terminal':{}}
let s:p.normal.left = [ [ s:grey2, s:base1, 'bold' ], s:flatten ]
let s:p.normal.right = [ [ s:grey2, s:base1 ], s:flatten ]
let s:p.normal.middle = [ s:below ]
let s:p.inactive.right = [ [ s:base3, s:grey2 ], [ s:base3, s:grey2 ] ]
let s:p.inactive.left = [ [ s:base3, s:grey2 ], [ s:base3, s:grey2 ] ]
let s:p.inactive.middle = [ [ s:base3, s:grey2 ] ]
" let insert2 = [ [ s:base0, s:blue3 ] ]
" let s:p.insert.middle = [ [ s:base0, s:blue4 ] ]
let s:p.insert.left = [ [ s:grey2, s:blue, 'bold' ], s:flatten ]
let s:p.insert.right = [ [ s:grey2, s:blue ], s:flatten ]
let s:p.insert.middle = [ s:flatten ]
let s:p.terminal.left = [ [ s:grey2, s:darkblue, 'bold' ], s:flatten ]
let s:p.terminal.right = [ [ s:grey2, s:darkblue ], s:flatten ]
let s:p.terminal.middle = [ s:flatten ]
let s:p.replace.left = [ [ s:grey2, s:red, 'bold' ], s:flatten ]
let s:p.replace.right = [ [ s:grey2, s:red ], s:flatten ]
let s:p.replace.middle = [ s:below ]
let s:p.visual.left = [ [ s:grey2, s:purple, 'bold' ], s:flatten ]
let s:p.visual.right = [ [ s:grey2, s:purple ], s:flatten ]
let s:p.visual.middle = [ s:below ]
let s:p.tabline.left = [ [ s:base0, s:grey1 ] ]
let s:p.tabline.tabsel = [ [ s:base0, s:background, 'bold' ] ]
let s:p.tabline.middle = [ [ s:grey0, s:grey0 ] ]
let s:p.tabline.right = [ [ s:base0, s:orange ] ]
let s:p.normal.error = [ [ s:base1, s:orange ] ]
let s:p.normal.warning = [ [ s:base1, s:yellow ] ]
return lightline#colorscheme#flatten(s:p)
endif
return {}
endfunc

" use g: so it isn't treated as a constant
let g:lightline#colorscheme#github#palette = lightline#colorscheme#github#compute()

Loading

0 comments on commit 1848e9b

Please sign in to comment.