mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-13 05:53:51 -05:00
Add colortable utility
This commit is contained in:
17
autoload/lightline/colortable.vim
Normal file
17
autoload/lightline/colortable.vim
Normal 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
|
||||||
Reference in New Issue
Block a user