Skip to content

Commit 90ec2a2

Browse files
author
skywind3000
committed
update
1 parent 65740af commit 90ec2a2

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

autoload/quickui/palette.vim

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,21 @@ endfunc
399399
" convert #112233 to [0x11, 0x22, 0x33]
400400
"----------------------------------------------------------------------
401401
function! quickui#palette#hex2rgb(hex)
402-
if strpart(a:hex, 0, 1) == '#'
402+
let [r, g, b] = [0, 0, 0]
403+
let head = strpart(a:hex, 0, 1)
404+
if head == '#'
403405
let cc = str2nr(strpart(a:hex, 1), 16)
404406
let r = and(cc / 0x10000, 0xff)
405407
let g = and(cc / 0x100, 0xff)
406408
let b = and(cc, 0xff)
407-
return [r, g, b]
409+
elseif head == '('
410+
let head = strpart(a:name, 1, len(a:name) - 2)
411+
let part = split(head, ',')
412+
let r = str2nr(part[0])
413+
let g = str2nr(part[1])
414+
let b = str2nr(part[2])
408415
endif
409-
return [0, 0, 0]
416+
return [r, g, b]
410417
endfunc
411418

412419

autoload/quickui/utils.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ function! quickui#utils#switch(filename, opts)
678678
let switch = get(a:opts, 'switch', switch)
679679
let method = split(switch, ',')
680680
let goto = get(a:opts, 'goto', -1)
681+
let ft = get(a:opts, 'ft', '')
681682
let cmds = get(a:opts, 'command', [])
682683
if type(a:filename) == type('')
683684
let filename = expand(a:filename)
@@ -775,6 +776,9 @@ function! quickui#utils#switch(filename, opts)
775776
if goto > 0
776777
exec ':' . goto
777778
endif
779+
if ft != ''
780+
exec 'setlocal ft=' . fnameescape(ft)
781+
endif
778782
for cmd in cmds
779783
exec cmd
780784
endfor

0 commit comments

Comments
 (0)