- 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.
Canvas.color read/write property
Get or set the Canvas drawing color.
Example
require "canvas"
-- create a simple window
local win = ui.Window("canvas.color sample", "fixed", 500, 400)
local canvas = ui.Canvas(win)
canvas.align = "all"
canvas:clear(0x000000FF)
win:show()
-- update user interface
repeat
canvas:begin()
canvas.color = math.random(0xFFFFFFFF)
for i=1,10 do
canvas:fillellipse(math.random(500), math.random(400), math.random(15), math.random(15))
end
canvas:flip()
ui.update()
until not win.visible