term.getTextColor
From ComputerCraft Wiki
Revision as of 12:08, 28 June 2015 by MKlegoman357 (Talk | contribs)
Function term.getTextColor | |
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
Example | |
Prints the current text color of the terminal. | |
Code |
local currentTextColor = term.getTextColor() print( "The current text color is: ", currentTextColor ) |
Example | |
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 ) |