Skip to content

Commit

Permalink
ref(winbar): pad the hex with 6 zeroes using string.format
Browse files Browse the repository at this point in the history
  • Loading branch information
tamton-aquib authored and NTBBloodbath committed Mar 27, 2024
1 parent 1bad966 commit 0977807
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lua/rest-nvim/result/winbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,8 @@ winbar.pane_map = {
---@param name string Highlighting group name
---@return string
local function get_hl_group_fg(name)
-- If the HEX color has a zero as the first character, `string.format` will skip it
-- so we have to add it manually later
local hl_fg = string.format("%02X", vim.api.nvim_get_hl(0, { name = name, link = false }).fg)
if #hl_fg == 4 then
hl_fg = "00" .. hl_fg
elseif #hl_fg == 5 then
hl_fg = "0" .. hl_fg
end
hl_fg = "#" .. hl_fg
return hl_fg
-- This will still error out if the highlight doesn't exist
return string.format("#%06X", vim.api.nvim_get_hl(0, { name = name, link = false }).fg)
end

---Set the results window winbar highlighting groups
Expand Down

0 comments on commit 0977807

Please sign in to comment.