More widgets stuff, cleaning code

This commit is contained in:
Insality
2024-11-19 23:06:57 +02:00
parent 37190684c4
commit c35dfc7066
36 changed files with 1494 additions and 508 deletions

View File

@@ -13,6 +13,13 @@ local M = {}
---@param color_id string
---@return vector4
function M.get(color_id)
-- Check is it hex: starts with "#" or contains only 3 or 6 hex symbols
if type(color_id) == "string" then
if string.sub(color_id, 1, 1) == "#" or string.match(color_id, "^[0-9a-fA-F]+$") then
return M.hex2vector4(color_id)
end
end
return PALETTE_DATA[CURRENT_PALETTE] and PALETTE_DATA[CURRENT_PALETTE][color_id] or DEFAULT_COLOR
end