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 :

  • "black"
  • "blue"
  • "green"
  • "cyan"
  • "red"
  • "purple"
  • "yellow"
  • "white"
  • "gray"
  • "lightblue"
  • "lightgreen"
  • "lightcyan"
  • "lightred"
  • "lightpurple"
  • "lightyellow"
  • "brightwhite"

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