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