├── LICENSE ├── README.md └── colors └── seattle.vim /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Ming, Bai 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Seattle - An elegant yet efficient color scheme for coders 2 | 3 | ### Features 4 | * Decent contrast - not too high and not too low, good for eyes and easy to read. 5 | * Beautiful colors - in my opinion. 6 | * Cterm colors offline generator - change the RGB value and generate cterm 256 colors, simple. 7 | * Color palette for customization - never been so easy. 8 | * Syntax highlighting preview - WYSIWYG 9 | 10 | ### Screen Shots 11 | #### Color Palette 12 | 13 | #### C/C++ 14 | 15 | #### HTML 16 | 17 | #### JavaScript 18 | 19 | 20 | ### Customization How-to 21 | * Open colors/seattle.vim and follow the instructions. 22 | -------------------------------------------------------------------------------- /colors/seattle.vim: -------------------------------------------------------------------------------- 1 | " Seattle 2 | " An elegant yet efficient color scheme for coders 3 | " Author: MingBai 4 | " 5 | " " 6 | " " 7 | " " 8 | " " 9 | " " 10 | " 11 | " To Enable Color Preview: 12 | " :SeattleLightsUp 13 | " 14 | " To Update Cterm Color After Modifying RGB Color: 15 | " :SeattleNeon 16 | 17 | " {{{ 18 | " CMD is not supported currently. 19 | if &term == "win32" 20 | finish 21 | endif 22 | set background=dark 23 | if exists("g:syntax_on") 24 | syntax reset 25 | endif 26 | hi clear 27 | let g:colors_name="seattle" 28 | " }}} 29 | 30 | " Color Palette 31 | " GUI BEGIN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 32 | highlight Normal guifg=#cccccc guibg=#292929 33 | 34 | highlight CP_01 guifg=#CCCCCC 35 | highlight CP_02 guifg=#7f7f7f gui=italic 36 | highlight CP_03 guifg=#87C0E0 gui=underline 37 | highlight CP_04 guifg=#292929 guibg=#CCCCCC 38 | highlight CP_05 guifg=NONE guibg=#4D4D4D 39 | highlight CP_06 guifg=#7F7F7F guibg=#333333 40 | highlight CP_07 guifg=#4D4D4D guibg=#4D4D4D 41 | highlight CP_08 guifg=NONE guibg=#666666 42 | highlight CP_09 guifg=#AAAAAA guibg=#333333 43 | highlight CP_0A guifg=#7f7f7f 44 | 45 | highlight CP_11 guifg=#F06A6A 46 | highlight CP_12 guifg=#F69A42 47 | highlight CP_13 guifg=#FAC863 48 | highlight CP_14 guifg=#DDA790 49 | highlight CP_15 guifg=#AB7967 50 | highlight CP_16 guifg=#99C794 51 | highlight CP_17 guifg=#5FB3B3 52 | highlight CP_18 guifg=#63B0DC 53 | highlight CP_19 guifg=#6699CC 54 | highlight CP_1a guifg=#C594C5 55 | highlight CP_1b guifg=#EE799F 56 | 57 | highlight CP_21 guibg=#F06A6A guifg=#000000 58 | highlight CP_22 guibg=#F69A42 guifg=#000000 59 | highlight CP_23 guibg=#FAC863 guifg=#000000 60 | highlight CP_24 guibg=#DDA790 guifg=#000000 61 | highlight CP_25 guibg=#AB7967 guifg=#000000 62 | highlight CP_26 guibg=#99C794 guifg=#000000 63 | highlight CP_27 guibg=#5FB3B3 guifg=#000000 64 | highlight CP_28 guibg=#63B0DC guifg=#000000 65 | highlight CP_29 guibg=#6699CC guifg=#000000 66 | highlight CP_2a guibg=#C594C5 guifg=#000000 67 | highlight CP_2b guibg=#EE799F guifg=#000000 68 | 69 | highlight CP_31 guibg=#F06A6A guifg=#FFFFFF 70 | highlight CP_32 guibg=#F69A42 guifg=#FFFFFF 71 | highlight CP_33 guibg=#FAC863 guifg=#FFFFFF 72 | highlight CP_34 guibg=#DDA790 guifg=#FFFFFF 73 | highlight CP_35 guibg=#AB7967 guifg=#FFFFFF 74 | highlight CP_36 guibg=#99C794 guifg=#FFFFFF 75 | highlight CP_37 guibg=#5FB3B3 guifg=#FFFFFF 76 | highlight CP_38 guibg=#63B0DC guifg=#FFFFFF 77 | highlight CP_39 guibg=#6699CC guifg=#FFFFFF 78 | highlight CP_3a guibg=#C594C5 guifg=#FFFFFF 79 | highlight CP_3b guibg=#EE799F guifg=#FFFFFF 80 | " GUI END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 81 | 82 | if !has("gui_running") 83 | set t_Co=256 84 | " Lines between CTERM BEGIN and CTERM END will be re-written, 85 | " so DO NOT EDIT! Change GUI colors then call SeattleNeon() 86 | " CTERM BEGIN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 87 | highlight Normal ctermfg=252 ctermbg=235 88 | highlight CP_01 ctermfg=252 89 | highlight CP_02 ctermfg=244 cterm=NONE 90 | highlight CP_03 ctermfg=110 cterm=underline 91 | highlight CP_04 ctermfg=235 ctermbg=252 92 | highlight CP_05 ctermfg=NONE ctermbg=239 93 | highlight CP_06 ctermfg=244 ctermbg=236 94 | highlight CP_07 ctermfg=239 ctermbg=239 95 | highlight CP_08 ctermfg=NONE ctermbg=241 96 | highlight CP_09 ctermfg=248 ctermbg=236 97 | highlight CP_0A ctermfg=244 98 | highlight CP_11 ctermfg=203 99 | highlight CP_12 ctermfg=209 100 | highlight CP_13 ctermfg=221 101 | highlight CP_14 ctermfg=180 102 | highlight CP_15 ctermfg=137 103 | highlight CP_16 ctermfg=114 104 | highlight CP_17 ctermfg=73 105 | highlight CP_18 ctermfg=74 106 | highlight CP_19 ctermfg=68 107 | highlight CP_1a ctermfg=176 108 | highlight CP_1b ctermfg=211 109 | highlight CP_21 ctermbg=203 ctermfg=16 110 | highlight CP_22 ctermbg=209 ctermfg=16 111 | highlight CP_23 ctermbg=221 ctermfg=16 112 | highlight CP_24 ctermbg=180 ctermfg=16 113 | highlight CP_25 ctermbg=137 ctermfg=16 114 | highlight CP_26 ctermbg=114 ctermfg=16 115 | highlight CP_27 ctermbg=73 ctermfg=16 116 | highlight CP_28 ctermbg=74 ctermfg=16 117 | highlight CP_29 ctermbg=68 ctermfg=16 118 | highlight CP_2a ctermbg=176 ctermfg=16 119 | highlight CP_2b ctermbg=211 ctermfg=16 120 | highlight CP_31 ctermbg=203 ctermfg=231 121 | highlight CP_32 ctermbg=209 ctermfg=231 122 | highlight CP_33 ctermbg=221 ctermfg=231 123 | highlight CP_34 ctermbg=180 ctermfg=231 124 | highlight CP_35 ctermbg=137 ctermfg=231 125 | highlight CP_36 ctermbg=114 ctermfg=231 126 | highlight CP_37 ctermbg=73 ctermfg=231 127 | highlight CP_38 ctermbg=74 ctermfg=231 128 | highlight CP_39 ctermbg=68 ctermfg=231 129 | highlight CP_3a ctermbg=176 ctermfg=231 130 | highlight CP_3b ctermbg=211 ctermfg=231 131 | " CTERM END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 132 | endif " has gui_running 133 | 134 | " Real color definitions starts from here 135 | " Syntax highlighting groups, using "!" to avoid E414 136 | highlight! link Normal CP_01 137 | highlight! link Comment CP_02 138 | highlight! link Constant CP_1b 139 | highlight! link Identifier CP_16 140 | highlight! link Function CP_18 141 | highlight! link Type CP_1a 142 | highlight! link Keyword CP_12 143 | highlight! link PreProc CP_1b 144 | highlight! link Statement CP_14 145 | highlight! link Special CP_16 146 | highlight! link Underlined CP_03 147 | highlight! link Ignore CP_02 148 | highlight! link Error CP_21 149 | highlight! link Todo CP_22 150 | highlight! link Directory CP_18 151 | highlight! link Title CP_14 152 | " Others 153 | highlight! link SignColumn CP_01 154 | highlight! link Cursor CP_04 155 | highlight! link CursorLine CP_05 156 | highlight! link CursorColumn CP_05 157 | highlight! link ErrorMsg CP_31 158 | highlight! link FoldColumn CP_08 159 | highlight! link Folded CP_08 160 | highlight! link IncSearch CP_28 161 | highlight! link LineNr CP_06 162 | highlight! link MatchParen CP_03 163 | highlight! link ModeMsg CP_18 164 | highlight! link MoreMsg CP_16 165 | highlight! link NonText CP_15 166 | highlight! link Pmenu CP_28 167 | highlight! link PmenuSel CP_35 168 | highlight! link Question CP_1a 169 | highlight! link Search CP_39 170 | highlight! link SpecialKey CP_0A 171 | highlight! link StatusLine CP_24 172 | highlight! link StatusLineNC CP_06 173 | highlight! link VertSplit CP_07 174 | highlight! link Visual CP_08 175 | highlight! link WarningMsg CP_11 176 | highlight! link WildMenu CP_05 177 | highlight! link colorcolumn CP_06 178 | highlight! link TabLine CP_18 179 | highlight! link TabLineFill CP_06 180 | highlight! link TabLineSel CP_28 181 | " Diff 182 | highlight! link DiffAdd CP_26 183 | highlight! link DiffChange CP_28 184 | highlight! link DiffDelete CP_05 185 | highlight! link DiffText CP_2b 186 | 187 | " {{{ Unimportant stuff 188 | let s:gray_scale_json = '{ 189 | \"000000":16, 190 | \"080808":232, 191 | \"121212":233, 192 | \"1c1c1c":234, 193 | \"262626":235, 194 | \"303030":236, 195 | \"3a3a3a":237, 196 | \"444444":238, 197 | \"4e4e4e":239, 198 | \"585858":240, 199 | \"626262":241, 200 | \"6c6c6c":242, 201 | \"767676":243, 202 | \"808080":244, 203 | \"8a8a8a":245, 204 | \"949494":246, 205 | \"9e9e9e":247, 206 | \"a8a8a8":248, 207 | \"b2b2b2":249, 208 | \"bcbcbc":250, 209 | \"c6c6c6":251, 210 | \"d0d0d0":252, 211 | \"dadada":253, 212 | \"e4e4e4":254, 213 | \"eeeeee":255, 214 | \"ffffff":231 215 | \}' 216 | 217 | function! s:read_rgb_txt() 218 | let rgb_file = $VIMRUNTIME."/rgb.txt" 219 | let rgb_lines = readfile(rgb_file) 220 | let ret = {} 221 | " each line is like r g b name 222 | for line in rgb_lines 223 | let s = split(line) 224 | let key = tolower(s[3]) 225 | let ret[key] = printf("%02x", str2nr(s[0])). 226 | \printf("%02x", str2nr(s[1])). 227 | \printf("%02x", str2nr(s[2])) 228 | endfor 229 | return ret 230 | endfunction 231 | 232 | function! s:close_color(c) 233 | let steps = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff] 234 | for i in range(5) 235 | if a:c >= steps[i] && a:c <= steps[i+1] 236 | if abs(a:c - steps[i]) < abs(steps[i+1] - a:c) 237 | return i 238 | else 239 | return i+1 240 | endif 241 | endif 242 | endfor 243 | endfunction 244 | 245 | let s:gray_scale = {} 246 | " accepts a number from 0-255 247 | function! s:close_gray_scale(c) 248 | if len(s:gray_scale) == 0 249 | let s:gray_scale = json_decode(s:gray_scale_json) 250 | endif 251 | let gs_keys = sort(keys(s:gray_scale)) 252 | for i in range(len(gs_keys)-1) 253 | let c1 = str2nr(gs_keys[i][:1], 16) 254 | let c2 = str2nr(gs_keys[i+1][:1], 16) 255 | if a:c >= c1 && a:c <= c2 256 | if abs(a:c - c1) < abs(a:c - c2) 257 | return s:gray_scale[gs_keys[i]] 258 | else 259 | return s:gray_scale[gs_keys[i+1]] 260 | endif 261 | endif 262 | endfor 263 | echoerr "Should not reach here" 264 | endfunction 265 | 266 | let s:color_name_to_rgb = {} 267 | " this function takes either #RRGGBB or a color name like blue 268 | function! s:rgb_to_256(rgb) 269 | let _rgb = tolower(a:rgb) 270 | " initialize once 271 | if len(s:color_name_to_rgb) == 0 272 | let s:color_name_to_rgb = s:read_rgb_txt() 273 | if len(s:color_name_to_rgb) == 0 274 | echoerr "Failed to read rgb.txt" 275 | return 0 276 | endif 277 | endif 278 | " get name->rgb from rgb.txt 279 | if has_key(s:color_name_to_rgb, _rgb) 280 | let _rgb = s:color_name_to_rgb[_rgb] 281 | elseif matchstr(_rgb, "^#") != "" 282 | let _rgb = _rgb[1:] 283 | endif 284 | if strlen(_rgb) != 6 285 | echoerr "Invalid rgb value: "._rgb 286 | return 287 | endif 288 | let r = str2nr(_rgb[:1], 16) 289 | let g = str2nr(_rgb[2:3], 16) 290 | let b = str2nr(_rgb[4:], 16) 291 | " process gray scale if r g b is close 292 | if abs(r-g)<=2 && abs(g-b)<=2 293 | return s:close_gray_scale((r+g+b) / 3) 294 | endif 295 | return s:close_color(r) * 36 296 | \+ s:close_color(g) * 6 297 | \+ s:close_color(b) + 16 298 | endfunction 299 | 300 | function! s:process_line(line) 301 | let result = a:line 302 | if match(result, "^highlight") 303 | return "" 304 | endif 305 | " Starts processing 306 | let guis = ["guifg", "guibg", "gui"] 307 | let cterms = ["ctermfg", "ctermbg", "cterm"] 308 | for i in range(3) 309 | let matched = matchstr(a:line, guis[i].'=\S\+') 310 | if matched == "" 311 | continue 312 | endif 313 | let converted = matchstr(matched, '=\zs.*') 314 | " special treat for some unsupported properties 315 | if index(["italic","reverse","inverse","standout"], converted) != -1 316 | let converted = "NONE" 317 | endif 318 | if i != 2 && converted != "NONE" " do not convert gui= or NONE 319 | let converted = s:rgb_to_256(converted) 320 | endif 321 | let converted = cterms[i] . "=" . converted 322 | let result = substitute(result, matched, converted, "") 323 | endfor 324 | return result 325 | endfunction 326 | 327 | function! s:SeattleLightsUp() 328 | if v:version < 800 329 | echoerr "The magic power needs Vim 8.0 and later." 330 | return 331 | endif 332 | if exists("s:run_once") 333 | return 334 | else 335 | let s:run_once = 1 336 | endif 337 | let current_filename = expand('%:p') 338 | let lines = readfile(current_filename) 339 | for i in lines 340 | " highlight link 341 | let hi_name = matchstr(i, '^highlight!\s\+link\s\+\zs\S\+\ze') 342 | if hi_name != "" 343 | exec "syn match " . hi_name . ' "^highlight! link '.hi_name.'\s*"' 344 | continue 345 | endif 346 | " normal highlight 347 | let hi_name = matchstr(i, '^highlight\s\+\zs\S\+\ze') 348 | if hi_name != "" 349 | exec "syn match " . hi_name . ' "^highlight '.hi_name.'\s*"' 350 | continue 351 | endif 352 | endfor 353 | " Magic.. 354 | call map(json_decode("[{4:4,10:6,18:4,24:6,31:6,38:2,45:6},{3:2,10:2,17:2, 355 | \21:2,26:2,33:2,38:2,45:2},{4:4,10:4,17:6,26:2,33:2,38:2,45:4},{7:2, 356 | \10:2,17:2,21:2,26:2,33:2,38:2,45:2},{4:4,10:6,17:2,21:2,26:2,33:2,38:6, 357 | \45:6}]"),{i,v->(map(v,{m,n->(i+matchadd("CP_2".(i+1),'\%'.(i+5).'l\%'.m. 358 | \'c.\{'.n.'}',99))}))}) 359 | endfunction 360 | 361 | function! s:SeattleNeon() 362 | if v:version < 800 363 | echoerr "The magic power needs Vim 8.0 and later." 364 | return 365 | endif 366 | let saved_cursor = getcurpos() 367 | let gui_begin = search("^\" GUI BEGIN") 368 | let gui_end = search("^\" GUI END") 369 | if gui_begin == 0 || gui_end == 0 || gui_begin >= gui_end 370 | echoerr "Invalid GUI marker" 371 | return 372 | endif 373 | if gui_begin >= gui_end-1 374 | echoerr "Empty highlight lines?" 375 | return 376 | endif 377 | let cterm_lines = [] 378 | for i in range(gui_begin+1, gui_end-1) 379 | let line = s:process_line(getline(i)) 380 | if line != "" 381 | let cterm_lines += [ line ] 382 | endif 383 | endfor 384 | let cterm_begin = search("^\" CTERM BEGIN") + 1 385 | let cterm_end = search("^\" CTERM END") - 1 386 | if cterm_begin == 0 || cterm_end == 0 || cterm_begin > cterm_end+1 387 | echoerr "Invalid CTERM marker" 388 | return 389 | endif 390 | if cterm_end >= cterm_begin 391 | exec cterm_begin . "," . cterm_end . " delete" 392 | endif 393 | call append(cterm_begin-1, cterm_lines) 394 | call setpos('.', saved_cursor) 395 | call s:SeattleLightsUp() 396 | endfunction 397 | 398 | command! SeattleLightsUp so % | call s:SeattleLightsUp() 399 | command! SeattleNeon so % | call s:SeattleNeon() 400 | " }}} 401 | " vim: set ts=4 et ft=vim ff=unix fdm=marker: 402 | --------------------------------------------------------------------------------