mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
More widgets stuff, cleaning code
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user