term.getBackgroundColour
(Redirected from Term.getBackgroundColor)
term.getBackgroundColour Function | |
---|---|
Syntax term.getBackgroundColour() | |
Returns | number colour |
API | term |
Source | CC:Tweaked (source) |
Returns the numerical value of the current background colour of the terminal object.
|
|||
Prints the numerical value of the current term's background colour. | |||
Code | print(term.getBackgroundColour())
|
||
Output | 32768
|
|
|||
Gets the current term's background colour, and then matches it against a lookup table to get its name. | |||
Code | 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.getBackgroundColour()
print(lookup[colour])
|
||
Output | black
|