Blocker by default is enabled, update color palette, add rich text split by characters option, able to pass a data to GO widgets

This commit is contained in:
Insality
2025-05-27 23:10:32 +03:00
parent fe955b6e64
commit 2e1f280944
8 changed files with 58 additions and 27 deletions

View File

@@ -8,9 +8,13 @@ local M = {}
---Get color by string (hex or from palette)
---@param color_id string Color id from palette or hex color
---@param color_id string|vector4 Color id from palette or hex color
---@return vector4
function M.get_color(color_id)
if type(color_id) == "vector4" then
return color_id
end
if PALETTE_DATA[color_id] then
return PALETTE_DATA[color_id]
end
@@ -175,21 +179,15 @@ function M.rgb2hex(red, green, blue)
end
local load_palette_from_json = function(path)
local data = sys.load_resource(path)
local DEFAULT_PALETTE_PATH = sys.get_config_string("druid.palette_path")
if DEFAULT_PALETTE_PATH then
local loaded_palette = sys.load_resource(DEFAULT_PALETTE_PATH)
local data = loaded_palette and json.decode(loaded_palette)
if not data then
return
end
return json.decode(data)
end
local DEFAULT_PALETTE_PATH = sys.get_config_string("druid.palette_path")
if DEFAULT_PALETTE_PATH then
local loaded_palette = load_palette_from_json(DEFAULT_PALETTE_PATH)
if loaded_palette and loaded_palette["default"] then
M.add_palette(loaded_palette["default"])
end
M.add_palette(data)
end