Skip to content

Commit

Permalink
Merge pull request #15 from NStefan002/fix
Browse files Browse the repository at this point in the history
fix(highlights): remove unnecessary hlgroups, don't be limited to 4x4 max value
  • Loading branch information
NStefan002 authored Mar 17, 2024
2 parents 68efe98 + 7aa1491 commit 57f9c7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 0 additions & 5 deletions lua/2048/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ function Highlights.setup()
vim.api.nvim_set_hl(ns_id, "2048_Value1024", { fg = "#ffffff", bg = "#edc53f", bold = true })
vim.api.nvim_set_hl(ns_id, "2048_Value2048", { fg = "#ffffff", bg = "#edc22e", bold = true })
vim.api.nvim_set_hl(ns_id, "2048_Value4096", { fg = "#ffffff", bg = "#000000", bold = true })
vim.api.nvim_set_hl(ns_id, "2048_Value8192", { fg = "#ffffff", bg = "#000000", bold = true })
vim.api.nvim_set_hl(ns_id, "2048_Value16384", { fg = "#ffffff", bg = "#000000", bold = true })
vim.api.nvim_set_hl(ns_id, "2048_Value32768", { fg = "#ffffff", bg = "#000000", bold = true })
vim.api.nvim_set_hl(ns_id, "2048_Value65536", { fg = "#ffffff", bg = "#000000", bold = true })
vim.api.nvim_set_hl(ns_id, "2048_Value131072", { fg = "#ffffff", bg = "#000000", bold = true })
vim.api.nvim_set_hl(ns_id, "2048_Background", { fg = "#aa9c8f", bg = "#aa9c8f", bold = true })
vim.api.nvim_set_hl(ns_id, "2048_Confirmation", { fg = "#ffffff", bg = "#aa9c8f", bold = true })
end
Expand Down
3 changes: 2 additions & 1 deletion lua/2048/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ function M:draw_square(x, y, i, j, _use_prev_state)
else
value = self.cs.values[i][j]
end
local hl_grp = "2048_Value" .. tostring(value)
value = math.min(value, 4096)
local hl_grp = string.format("2048_Value%s", tonumber(value))
for k = 0, self._square_height - 1 do
vim.api.nvim_buf_add_highlight(
self.bufnr,
Expand Down

0 comments on commit 57f9c7e

Please sign in to comment.