term.getTextColour
Returns the numerical value of the current text colour of the terminal object.
|
|||
Prints the numerical value of the current term's text colour. | |||
Code | <nowiki>
print(term.getTextColour())
</nowiki>
|
||
Output | 1
|
|
|||
Gets the current term's text colour, and then matches it against a lookup table to get its name. | |||
Code | <nowiki>
local lookup = {
[1] = "white", [2] = "orange", [4] = "magenta", [8] = "lightBlue",
[16] = "yellow", [32] = "lime", [64] = "pink", [128] = "gray",
[256] = "lightGray", [512] = "cyan", [1024] = "purple", [2048] = "blue",
[4096] = "brown", [8192] = "green", [16384] = "red", [32768] = "black"
}
local colour = term.getTextColour()
print(lookup[colour])
</nowiki>
|
||
Output | white
|
term.getTextColour Function | |
---|---|
Syntax term.getTextColour() | |
Returns | number colour |
API | term |
Source | CC:Tweaked (source) |
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.