mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-05-04 23:10:29 +02:00
convert msdos.vim
This commit is contained in:
parent
609205f1e8
commit
0abcdbeba5
@ -22,7 +22,7 @@ scriptencoding utf-8
|
|||||||
" 14 Yellow
|
" 14 Yellow
|
||||||
" 15 White
|
" 15 White
|
||||||
|
|
||||||
let s:basic16 = [
|
const s:basic16 = [
|
||||||
\ [ 0x00, 0x00, 0x00 ],
|
\ [ 0x00, 0x00, 0x00 ],
|
||||||
\ [ 0x00, 0x00, 0x80 ],
|
\ [ 0x00, 0x00, 0x80 ],
|
||||||
\ [ 0x00, 0x80, 0x00 ],
|
\ [ 0x00, 0x80, 0x00 ],
|
||||||
@ -41,6 +41,26 @@ let s:basic16 = [
|
|||||||
\ [ 0xFF, 0xFF, 0xFF ]
|
\ [ 0xFF, 0xFF, 0xFF ]
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
|
if exists(":def")
|
||||||
|
def airline#msdos#round_msdos_colors(rgblist: list<number>): string
|
||||||
|
# Check for values from MSDOS 16 color terminal
|
||||||
|
var best = []
|
||||||
|
var min = 100000
|
||||||
|
var t = 0
|
||||||
|
for value in s:basic16
|
||||||
|
t = abs(value[0] - rgblist[0]) +
|
||||||
|
abs(value[1] - rgblist[1]) +
|
||||||
|
abs(value[2] - rgblist[2])
|
||||||
|
if min > t
|
||||||
|
min = t
|
||||||
|
best = value
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return string(index(s:basic16, best))
|
||||||
|
enddef
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
function! airline#msdos#round_msdos_colors(rgblist)
|
function! airline#msdos#round_msdos_colors(rgblist)
|
||||||
" Check for values from MSDOS 16 color terminal
|
" Check for values from MSDOS 16 color terminal
|
||||||
let best = []
|
let best = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user