Add colortable utility

This commit is contained in:
mattn
2013-08-22 12:05:53 +09:00
parent 0ada9d6d35
commit a51dea0bc4

View File

@@ -0,0 +1,17 @@
function! s:load()
let rgbfile = $VIMRUNTIME . '/rgb.txt'
let table = {}
if filereadable(rgbfile)
for _ in map(filter(readfile(rgbfile), 'v:val !~ "^!"'), 'matchlist(v:val, "^\\s*\\(\\d\\+\\)\\s\\+\\(\\d\\+\\)\\s\\+\\(\\d\\+\\)\\s\\+\\(.*\\)")[1:4]')
let table[tolower(_[3])] = _[0:2]
endfor
endif
return table
endfunction
let s:table = s:load()
function! lightline#colortable#name_to_rgb(name)
let name = tolower(a:name)
return has_key(s:table, name) ? s:table[name] : []
endfunction