ui.colordialog([color])

Displays a dialog box for the user to choose a color.

Parameters

color

An optional number that indicates the current color in the dialog.

Return value

This function returns a number representing a RGB color (one byte per primary color), or nil if no color have been choosen.
A RGB color can be represented as an hexadecimal number : 0xRRGGBB, RR meaning a 8bit hexadecimal red value and so on.

Example

local ui = require "ui" -- open a dialog to choose a color local color = ui.colordialog() -- check if a color have been choosen if color ~= nil then -- output color value local msg = "Color : 0x"..string.format("%06X", color).."\nRed : #"..string.format("%02X", (color>>16)&0x0FF).."\nGreen : #"..string.format("%02X", (color>>8)&0x0FF).."\nBlue : #"..string.format("%02X", color&0x0FF) ui.info(msg) end