Skip to content

Commit 7c6347a

Browse files
authored
Merge pull request #9 from Brayan-724/fix/vim-theme
fix: get hl colors
2 parents 5750d07 + 46ccf6e commit 7c6347a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lua/codeshot/theme.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
local theme = {}
22

3+
local function hex_fmt(str)
4+
return string.format('#%06x', str)
5+
end
6+
37
function theme._gen_hl(hl)
48
local styles = { 'underline', 'undercurl', 'underdotted', 'bold', 'italic' }
59
local style = ''
@@ -12,8 +16,8 @@ function theme._gen_hl(hl)
1216
end
1317

1418
return {
15-
bg = hl.background and string.format('#%06x', hl.background) or '',
16-
fg = hl.foreground and string.format('#%06x', hl.foreground) or '',
19+
bg = hl.bg and hex_fmt(hl.bg) or hl.background and hex_fmt(hl.background) or '',
20+
fg = hl.fg and hex_fmt(hl.fg) or hl.foreground and hex_fmt(hl.foreground) or '',
1721
style = style,
1822
}
1923
end

0 commit comments

Comments
 (0)