This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Zenon's profile picture

Colors Help

Started by Zenon, 19 July 2015 - 06:30 PM
Zenon #1
Posted 19 July 2015 - 08:30 PM
Hi all! I was just wondering if anybody knew how to set a color up to equal input?
Example:

input = read()
term.setTextColor(color.input)
^That^ doesnt seem to work, so I was wondering if there was another way of doing that instead of the following:

input = read()
if input == "red" then
term.setTextColor(colors.red)
end

Thanks in advance!
KingofGamesYami #2
Posted 19 July 2015 - 09:06 PM

local input = read()
if colors[ input ] then
  term.setTextColor( colors[ input ] )
end
Zenon #3
Posted 19 July 2015 - 09:09 PM

local input = read()
if colors[ input ] then
  term.setTextColor( colors[ input ] )
end
Thanks a Bunch! You saved me a lot of writing haha