term.getTextColor
From ComputerCraft Wiki
| Gets the current text color of the terminal. Returns the same decimal color codes as seen in this page. Also available as term.getTextColour for British spelling.
| |
| Syntax | term.getTextColor() |
| Returns | number color code |
| Part of | ComputerCraft |
| API | term |
Examples
| Prints the current text color of the terminal. | |
| Code |
local currentTextColor = term.getTextColor() print( "The current text color is: ", currentTextColor ) |
| Prints the current text color name (rather than the number) of the terminal. | |
| Code |
local currentTextColor = term.getTextColor()
local colorName = "Unknown"
for key, value in pairs( colors ) do -- find the name of the color
if value == currentTextColor then
colorName = key
break
end
end
print( "The current text color is: ", colorName )
|