fix(CountersSelectors): createWriteWithColor
This commit is contained in:
parent
5501e06844
commit
ab17e80fa5
@ -6,20 +6,21 @@ end
|
|||||||
|
|
||||||
local function createWriteWithColor(textColor, backgroundColor, givenWin)
|
local function createWriteWithColor(textColor, backgroundColor, givenWin)
|
||||||
local win = givenWin or term
|
local win = givenWin or term
|
||||||
local originalTextColor = nil
|
|
||||||
local originalBackgroundColor = nil
|
|
||||||
|
|
||||||
if textColor then
|
|
||||||
originalTextColor = win.getTextColor()
|
|
||||||
win.setTextColor(textColor)
|
|
||||||
end
|
|
||||||
|
|
||||||
if backgroundColor then
|
|
||||||
originalBackgroundColor = win.getBackgroundColor()
|
|
||||||
win.setBackgroundColor(backgroundColor)
|
|
||||||
end
|
|
||||||
|
|
||||||
return function(str)
|
return function(str)
|
||||||
|
local originalTextColor = nil
|
||||||
|
local originalBackgroundColor = nil
|
||||||
|
|
||||||
|
if textColor then
|
||||||
|
originalTextColor = win.getTextColor()
|
||||||
|
win.setTextColor(textColor)
|
||||||
|
end
|
||||||
|
|
||||||
|
if backgroundColor then
|
||||||
|
originalBackgroundColor = win.getBackgroundColor()
|
||||||
|
win.setBackgroundColor(backgroundColor)
|
||||||
|
end
|
||||||
|
|
||||||
win.write(str)
|
win.write(str)
|
||||||
|
|
||||||
if originalTextColor then
|
if originalTextColor then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user