Luart
Comprehensive Windows framework to develop in Lua
modules > console > bgcolor

console.bgcolor read/write property

The console.bgcolor property sets or gets the current console background color. The color is represented by a string. Possible values are :

Example


local console = require "console"

local colors = { "black", "blue", "green", "cyan", "red", "purple", "yellow",
 "white", "gray", "lightblue", "lightgreen", "lightcyan", "lightred", 
 "lightmagenta", "lightyellow", "brightwhite" }

-- prints a rainbow
for color in each(colors) do
	console.bgcolor = color
	console.write(string.rep(" ", console.width))
end