Skip to content

Commit 394064a

Browse files
committed
Fixed for python3.
1 parent 3a9bd91 commit 394064a

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

after/autoload/csscolor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def index_to_rgb(index):
7272
elif 233 <= index < 254:
7373
return [8+(index-232)*0x0A]*3
7474

75-
colortable = [index_to_rgb(color) for color in range(0, 254)]
75+
colortable = list(map(index_to_rgb, range(0, 254)))
7676

7777
@staticmethod
7878
def diff(rgb1, rgb2):

after/autoload/csscolor.vim

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,25 @@ set cpo&vim
1111
function! csscolor#initialize()
1212
let pycode = globpath(&rtp, 'autoload/csscolor.py')
1313
if has('python')
14-
execute 'pyfile' pycode
14+
let s:pyfile = 'pyfile'
15+
let s:python = 'python'
1516
elseif has('python3')
16-
execute 'py3file' pycode
17+
let s:pyfile = 'py3file'
18+
let s:python = 'python3'
1719
else
1820
echoerr 'Python interface is not available.'
21+
finish
1922
endif
23+
execute s:pyfile pycode
2024
endfunction
2125
call csscolor#initialize()
2226

2327
function! csscolor#percentage_to_code(r, g, b)
24-
execute "python VimCSSColor.percentage_to_code('".a:r."','".a:g."','".a:b."')"
28+
execute s:python "VimCSSColor.percentage_to_code('".a:r."','".a:g."','".a:b."')"
2529
endfunction
2630

2731
function! csscolor#add_highlight(group, color)
28-
execute "python VimCSSColor.add_highlight('".a:group."', '".a:color."')"
32+
execute s:python "VimCSSColor.add_highlight('".a:group."', '".a:color."')"
2933
endfunction
3034

3135
function! csscolor#is_syntax_exist(pattern, group)

0 commit comments

Comments
 (0)