Small color fix for labels

fixed bug with foreground/background colors, when using xml
This commit is contained in:
Robert Jelic
2023-06-08 09:13:03 +02:00
parent af14c7b867
commit 26567debd6
2 changed files with 13 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ return function(name, basalt)
base:setSize(5, 1)
base:setBackground(false)
local fgChanged = false
local autoSize = true
local text, textAlign = "Label", "left"
@@ -47,6 +49,12 @@ return function(name, basalt)
return self
end,
setForeground = function(self, col)
base.setForeground(self, col)
fgChanged = true
return self
end,
--- Returns the label's autoSize property.
--- @return boolean
getAutoSize = function(self)
@@ -105,7 +113,9 @@ return function(name, basalt)
init = function(self)
base.init(self)
local parent = self:getParent()
self:setForeground(parent:getForeground())
if not(fgChanged)then
self:setForeground(parent:getForeground())
end
end
}

View File

@@ -71,6 +71,7 @@ return {
else
Reactive.effect(function()
local value = load("return " .. expression, nil, "t", env)()
if(colors[value]~=nil)then value = colors[value] end
object:setProperty(attribute, value)
end)
end
@@ -138,4 +139,4 @@ return {
}
return object
end
}
}