Canvas.bgcolor read/write property


Get or set the Canvas background color. When set, the canvas is cleared with this new color

  • The color is represented by a number, an RGBA value (one byte per primary color and one byte for alpha channel).
  • A RGBA color can be represented as an hexadecimal number : 0xRRGGBBAA , RR meaning a 8bit hexadecimal red value, and so on.

Example

local ui = require "ui" require "canvas" -- create a simple window local win = ui.Window("canvas.bgcolor sample", "fixed", 500, 400) local canvas = ui.Canvas(win) canvas.align = "all" -- don't use onPaint() canvas.sync = false win:show() -- update user interface repeat canvas:begin() canvas:clear(math.random(0xFFFFFFFF)) canvas:flip() ui.update() until not win.visible