fix hue overflow on farba command

This commit is contained in:
Ubuntu
2026-08-18 19:44:14 +00:00
parent 794c6ca2fc
commit b2019a18ee
+10 -1
View File
@@ -188,9 +188,18 @@ local bluloco = {
}
-- THE FUN COLOUR ONE
function wrapHue(h)
if h > 360 then
return h - (h%360)
end
if h < 0 then
return -1*((-1*h)%360) + 360
end
return h
end
local baseColour = 180
vim.api.nvim_create_user_command('FarbaColour', function(opts)
baseColour = tonumber(opts.args)
baseColour = wrapHue(tonumber(opts.args))
require("farba").setup({
cache = false,
mode = "dark", -- "light"|"dark" or let 'vim.o.background' decide with nil