term.getBackgroundColor
From ComputerCraft Wiki
Revision as of 12:18, 28 June 2015 by MKlegoman357 (Talk | contribs) (Created page with "{{Lowercase}} {{Function |name=term.getBackgroundColor |args= |returns={{type|number}} color code |api=term |addon=ComputerCraft |desc=Gets the current background color of the...")
Function term.getBackgroundColor | |
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
Example | |
Prints the current background color of the terminal. | |
Code |
local currentBackgroundColor = term.getBackgroundColor() print( "The current background color is: ", currentBackgroundColor ) |
Example | |
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 ) |