Skip to content

Commit

Permalink
fix: generate correct name for hls with 'NONE'
Browse files Browse the repository at this point in the history
  • Loading branch information
famiu committed Sep 19, 2021
1 parent 7469aa1 commit 8a8cbed
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lua/feline/generator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,18 @@ local function get_hlname(hl, parent_hl)

hl = parse_hl(hl, parent_hl)

local fg_str, bg_str

-- If first character of the color starts with '#', remove the '#' and keep the rest
-- If it doesn't start with '#', do nothing
if hl.fg:sub(1, 1) == '#' then fg_str = hl.fg:sub(2) else fg_str = hl.fg end
if hl.bg:sub(1, 1) == '#' then bg_str = hl.bg:sub(2) else bg_str = hl.bg end

-- Generate unique hl name from color strings if a name isn't provided
hl.name = hl.name or string.format(
'StatusComponent_%s_%s_%s',
string.sub(hl.fg, 2),
string.sub(hl.bg, 2),
fg_str,
bg_str,
string.gsub(hl.style, ',', '_')
)

Expand Down

0 comments on commit 8a8cbed

Please sign in to comment.