Small color fix for labels
fixed bug with foreground/background colors, when using xml
This commit is contained in:
@@ -12,6 +12,8 @@ return function(name, basalt)
|
|||||||
base:setSize(5, 1)
|
base:setSize(5, 1)
|
||||||
base:setBackground(false)
|
base:setBackground(false)
|
||||||
|
|
||||||
|
local fgChanged = false
|
||||||
|
|
||||||
local autoSize = true
|
local autoSize = true
|
||||||
local text, textAlign = "Label", "left"
|
local text, textAlign = "Label", "left"
|
||||||
|
|
||||||
@@ -47,6 +49,12 @@ return function(name, basalt)
|
|||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
setForeground = function(self, col)
|
||||||
|
base.setForeground(self, col)
|
||||||
|
fgChanged = true
|
||||||
|
return self
|
||||||
|
end,
|
||||||
|
|
||||||
--- Returns the label's autoSize property.
|
--- Returns the label's autoSize property.
|
||||||
--- @return boolean
|
--- @return boolean
|
||||||
getAutoSize = function(self)
|
getAutoSize = function(self)
|
||||||
@@ -105,7 +113,9 @@ return function(name, basalt)
|
|||||||
init = function(self)
|
init = function(self)
|
||||||
base.init(self)
|
base.init(self)
|
||||||
local parent = self:getParent()
|
local parent = self:getParent()
|
||||||
self:setForeground(parent:getForeground())
|
if not(fgChanged)then
|
||||||
|
self:setForeground(parent:getForeground())
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ return {
|
|||||||
else
|
else
|
||||||
Reactive.effect(function()
|
Reactive.effect(function()
|
||||||
local value = load("return " .. expression, nil, "t", env)()
|
local value = load("return " .. expression, nil, "t", env)()
|
||||||
|
if(colors[value]~=nil)then value = colors[value] end
|
||||||
object:setProperty(attribute, value)
|
object:setProperty(attribute, value)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -138,4 +139,4 @@ return {
|
|||||||
}
|
}
|
||||||
return object
|
return object
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user