Skip to content

Instantly share code, notes, and snippets.

@amn
Last active September 19, 2021 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amn/f77f67df54ad4471f2fa12262d7addf5 to your computer and use it in GitHub Desktop.
Save amn/f77f67df54ad4471f2fa12262d7addf5 to your computer and use it in GitHub Desktop.
An alternative, "austere" implementation of the Solarized color scheme for Vim
" URL: https://gist.github.com/amn/f77f67df54ad4471f2fa12262d7addf5
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "Solarized"
let s:base0 = "#839496"
let s:base00 = "#657b83"
let s:base01 = "#586e75"
let s:base02 = "#073642"
let s:base03 = "#002b36"
let s:base1 = "#93a1a1"
let s:base2 = "#eee8d5"
let s:base3 = "#fdf6e3"
let s:blue = "#268bd2"
let s:cyan = "#2aa198"
let s:green = "#859900"
let s:magenta = "#d33682"
let s:orange = "#cb4b16"
let s:red = "#dc322f"
let s:violet = "#6c71c4"
let s:yellow = "#b58900"
let s:bases = [ s:base03, s:base02, s:base01, s:base00, s:base0, s:base1, s:base2, s:base3 ]
if &background == "dark"
call reverse(s:bases)
endif
let s:default_attrs = { "gui": "NONE", "guibg": "NONE" }
function s:hl(group, attrs)
call extend(a:attrs, s:default_attrs, "keep")
let l:command = "highlight" . " " . a:group
for name in keys(a:attrs)
let l:command .= " " . name . "=" . a:attrs[name]
endfor
exe l:command
endfunction
call s:hl("ColorColumn", { "guibg": s:bases[6] })
call s:hl("Comment", { "guifg": s:bases[5] })
call s:hl("Constant", { "guifg": s:yellow })
call s:hl("Cursor", { "guifg": "white", "guibg": s:red })
call s:hl("CursorLine", { "guibg": s:bases[6] })
call s:hl("CursorLineNr", { "guifg": s:magenta, "guibg": s:bases[6] })
call s:hl("EndOfBuffer", { "guifg": s:bases[6] })
call s:hl("ErrorMsg", { "guifg": s:base3, "guibg": s:red })
call s:hl("Function", { "guifg": s:bases[4], "gui": "italic" })
call s:hl("Identifier", { "guifg": s:blue })
call s:hl("Keyword", { "guifg": s:bases[4], "gui": "italic" })
call s:hl("LineNr", { "guifg": s:bases[5], "guibg": s:bases[6] })
call s:hl("MatchParen", { "guifg": s:magenta })
call s:hl("NonText", { "guifg": s:bases[5] })
call s:hl("Normal", { "guifg": s:bases[3], "guibg": s:bases[7] })
call s:hl("PreProc", { "guifg": s:magenta })
call s:hl("SpecialKey", { "guifg": s:bases[5] })
call s:hl("Statement", { "guifg": s:green, "gui": "italic" })
call s:hl("StatusLine", { "guibg": s:base0 })
call s:hl("String", { "guifg": s:cyan })
call s:hl("Question", { "guifg": s:green })
call s:hl("Todo", { "guifg": s:magenta })
call s:hl("Type", { "guifg": s:yellow })
call s:hl("VertSplit", { "guifg": s:bases[5], "guibg": s:bases[5] })
call s:hl("WarningMsg", { "guifg": "white", "guibg": s:yellow })
@amn
Copy link
Author

amn commented Sep 19, 2021

I wrote this because I wanted to better understand both Vim scripting and implementing color schemes and syntax highlighting in Vim, so I have come up with the above. Solarized has stayed my favourite color scheme throughout several years now, but I have been having issues with the upstream implementation, which I can't name right now, so I ventured into writing my own minimal implementation of the same color scheme.

I expect it is missing a good deal of highlighting groups being specified (with hi), I may be adding those later and have a repository documenting history as is proper.

Please keep note of the fact that while the palette is (obviously) the same as the one from upstream, the distribution of the colors in the palette over different syntactic elements, may be different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment