Difference between revisions of "Term.getTextColor"
From ComputerCraft Wiki
MKlegoman357 (Talk | contribs) (Created page with "{{Lowercase}} {{Function |name=term.getTextColor |args= |returns={{type|number}} color code |api=term |addon=ComputerCraft |desc=Gets the current foreground color of the termi...") |
MKlegoman357 (Talk | contribs) m |
||
Line 6: | Line 6: | ||
|api=term | |api=term | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
− | |desc=Gets the current | + | |desc=Gets the current text color of the terminal. Returns the same decimal color codes as seen in [[Colors_(API)#Colors|this page]]. Also available as '''term.getTextColour''' for British spelling. |
<br> | <br> | ||
See also: [[term.setTextColor]]() | See also: [[term.setTextColor]]() |
Latest revision as of 12:08, 28 June 2015
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 ) |