Fix in theme.lua
This commit is contained in:
@@ -156,8 +156,9 @@ end
|
|||||||
--- Applies the current theme to this element
|
--- Applies the current theme to this element
|
||||||
--- @shortDescription Applies theme styles to the element
|
--- @shortDescription Applies theme styles to the element
|
||||||
--- @param self BaseElement The element to apply theme to
|
--- @param self BaseElement The element to apply theme to
|
||||||
|
--- @param applyToChildren boolean? Whether to apply theme to child elements (default: true)
|
||||||
--- @return BaseElement self The element instance
|
--- @return BaseElement self The element instance
|
||||||
function BaseElement:applyTheme()
|
function BaseElement:applyTheme(applyToChildren)
|
||||||
local styles = self:getTheme()
|
local styles = self:getTheme()
|
||||||
if(styles ~= nil) then
|
if(styles ~= nil) then
|
||||||
for prop, value in pairs(styles) do
|
for prop, value in pairs(styles) do
|
||||||
@@ -167,8 +168,6 @@ function BaseElement:applyTheme()
|
|||||||
if(type(value)=="string")then
|
if(type(value)=="string")then
|
||||||
if(colors[value])then
|
if(colors[value])then
|
||||||
value = colors[value]
|
value = colors[value]
|
||||||
else
|
|
||||||
errorManager.error("Invalid color '" .. value .. "' for property '" .. prop .. "' in theme for " .. self._values.type)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -178,11 +177,13 @@ function BaseElement:applyTheme()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(self:isType("Container"))then
|
if(applyToChildren~=false)then
|
||||||
local children = self.get("children")
|
if(self:isType("Container"))then
|
||||||
for _, child in ipairs(children) do
|
local children = self.get("children")
|
||||||
if(child and child.applyTheme)then
|
for _, child in ipairs(children) do
|
||||||
child:applyTheme()
|
if(child and child.applyTheme)then
|
||||||
|
child:applyTheme()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user