Better algorightm, to get msdos colors

currently, full 255 colors were returned, while in fact
msdos console only supports 16 colors. So fix this.
This commit is contained in:
Christian Brabandt
2016-01-27 20:37:58 +01:00
parent 1490f59e75
commit 768a475add
2 changed files with 60 additions and 4 deletions
+3 -4
View File
@@ -9,12 +9,11 @@ let s:accents = {}
function! s:gui2cui(rgb, fallback)
if a:rgb == ''
return a:fallback
elseif match(a:rgb, 'NONE\|[fb]g')
elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1
return a:rgb
endif
let rgb = map(matchlist(a:rgb, '#\(..\)\(..\)\(..\)')[1:3], '0 + ("0x".v:val)')
let rgb = [rgb[0] > 127 ? 4 : 0, rgb[1] > 127 ? 2 : 0, rgb[2] > 127 ? 1 : 0]
return rgb[0]+rgb[1]+rgb[2]
let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)')
return airline#msdos#round_msdos_colors(rgb)
endfunction
function! s:get_syn(group, what)