1
0
mirror of https://github.com/AR2000AR/openComputers_codes.git synced 2025-09-08 06:31:14 +02:00

[yawl] made color selection code more readable

This commit is contained in:
2023-08-11 23:10:00 +02:00
parent 87edbcaffa
commit 7b8ee449c0

View File

@@ -16,7 +16,11 @@ function Button:draw()
if self:resetTime() > 0 and self:state() and (computer.uptime() - self._pressed) > self:resetTime() then
self:state(false)
end
local newBG = self:state() and (self:foregroundColor() or 0xffffff - self:backgroundColor()) or self:backgroundColor()
local newBG = self:backgroundColor()
if (not self:state()) then
--set to the foreground color. if there is none, invert the current color
newBG = self:foregroundColor() or (0xffffff - self:backgroundColor())
end
local oldBG = gpu.setBackground(newBG)
gpu.fill(self:absX(), self:absY(), self:width(), self:height(), " ")
gpu.setBackground(oldBG)