Skip to content

Instantly share code, notes, and snippets.

@kLabz
Created May 22, 2022 19:52
Show Gist options
  • Select an option

  • Save kLabz/19afd5cf532fe04ee4e0ce1be47ed2e9 to your computer and use it in GitHub Desktop.

Select an option

Save kLabz/19afd5cf532fe04ee4e0ce1be47ed2e9 to your computer and use it in GitHub Desktop.

Revisions

  1. kLabz created this gist May 22, 2022.
    130 changes: 130 additions & 0 deletions colors.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,130 @@
    hi clear
    if exists("syntax_on")
    syntax reset
    endif
    let g:colors_name = "k"

    let s:palette = {
    \ 'bg': '#111111',
    \ 'fg': '#dedbd4',
    \ 'dull': '#f9edce',
    \ 'dark': '#2d2b28',
    \ 'deep': '#736a56',
    \ 'yellow': '#f8b218',
    \ 'orange': '#f37321',
    \ 'orangelight': '#f3c29b',
    \ 'orangedark': '#c74f03',
    \ 'orangebg': '#582d12',
    \ }

    function! s:Clear(group)
    execute 'highlight! clear ' . a:group
    execute 'highlight ' . a:group . ' NONE'
    endfunction

    function! s:Define(group, ...)
    call s:Clear(a:group)
    let l:histring = 'hi ' . a:group . ' '

    if strlen(a:1)
    let l:histring .= 'guifg=' . s:palette[a:1] . ' '
    endif

    if a:0 >= 2 && strlen(a:2)
    let l:histring .= 'guibg=' . s:palette[a:2] . ' '
    endif

    if a:0 >= 3 && strlen(a:3)
    let l:histring .= 'gui=' . a:3 . ' '
    endif

    if a:0 >= 4 && strlen(a:4)
    let l:histring .= 'guisp=' . s:palette[a:4] . ' '
    endif

    execute l:histring
    endfunction

    call s:Define('Normal', 'fg', 'bg', 'NONE')

    " Cursor and cross
    call s:Define('Cursor', 'bg', 'orange')
    call s:Define('CursorColumn', '', 'orangebg')
    call s:Define('CursorLine', '', '', 'underline', 'orangebg')
    call s:Define('CursorLineNr', 'orange', 'bg', 'inverse')

    " Slight difference for keywords, etc.
    call s:Define('Identifier', 'dull')
    call s:Define('Operator', 'dull')
    call s:Define('Special', 'dull')
    call s:Define('Statement', 'dull')
    call s:Define('StorageClass', 'dull')
    call s:Define('Typedef', 'dull')

    " Constants, strings, and comments stand out
    call s:Define('Comment', 'yellow')
    call s:Define('Constant', 'orangelight')
    call s:Define('String', 'orangelight')

    " Conditional compilation stands out too
    call s:Define('PreProc', 'orangelight', 'bg', 'inverse')
    call s:Define('Macro', 'fg') " But not metadata
    call s:Define('vimOption', 'fg') " Nor vim options

    " Cleanup for sh/zsh
    call s:Define('shCmdSubRegion', 'fg')
    call s:Define('shDerefSimple', 'fg')
    call s:Define('zshDeref', 'fg')
    call s:Define('zshShortDeref', 'fg')
    call s:Define('zshSubst', 'fg')

    " Light modification for types too, mostly for jsx
    call s:Define('Type', 'orangelight')
    call s:Define('ocamlModPath', 'orangelight')

    " Some indicators
    call s:Define('Todo', 'orangedark', 'bg', 'bold')
    call s:Define('Error', 'orange', 'bg', 'inverse')
    call s:Define('ErrorMsg', 'orange', 'bg', 'inverse')
    call s:Define('IncSearch', 'dull', 'bg', 'inverse')
    call s:Define('Search', 'yellow', 'bg', 'inverse')
    call s:Define('MatchParen', 'yellow', '', 'bold')

    " Links
    call s:Define('Underlined', 'orange', '', 'underline')

    " Markdown
    call s:Define('mkdHeading', 'yellow', '', 'bold')
    call s:Define('Title', 'orange')

    " ± hide some characters (whitespace, etc.)
    call s:Define('SpecialKey', 'deep')
    call s:Define('NonText', 'deep')

    " Completion, diagnostics
    call s:Define('Pmenu', 'fg', 'dark', 'NONE')
    call s:Define('PmenuSel', 'orange', 'dark', 'inverse')
    call s:Define('PmenuSbar', '', 'deep')
    call s:Define('PmenuThumb', '', 'orange')
    " call s:Define('WildMenu', 'fg', 'dark', 'NONE')

    " Folds
    call s:Define('Folded', 'dull', 'dark', 'NONE')
    call s:Define('FoldColumn', 'dull', 'dark', 'NONE')

    " UI
    call s:Define('ColorColumn','fg', 'dark', 'NONE')
    call s:Define('LineNr', 'orangedark', 'bg', 'NONE')
    call s:Define('VertSplit', 'yellow', 'bg')
    call s:Define('Visual', 'bg', 'orange')

    " NERDtree
    call s:Define('NERDTreeDir', 'orange')
    call s:Define('NERDTreeDirSlash', 'yellow')
    call s:Define('NERDTreeCWD', 'yellow')
    call s:Define('NERDTreeOpenable', 'yellow')
    call s:Define('NERDTreeClosable', 'yellow')
    call s:Define('NERDTreeExecFile', 'yellow')
    call s:Define('NERDTreeHelpTitle', 'yellow')
    call s:Define('NERDTreeHelpKey', 'orange')
    call s:Define('NERDTreeFlags', 'yellow')