API:ColorPickerAddColorAtPosition
From RoR Wiki
UI Lua API · ColorPicker functions
Version: WAR 1.4.8
Adds one colour swatch to a ColorPicker at a given position.
ColorPickerAddColorAtPosition(colorPickerName, r, g, b, id, x, y)
Arguments
- colorPickerName
string– Name of the ColorPicker.- r, g, b
number– Colour components on a 0–255 scale.- id
number– Your identifier for the colour (converted to a whole number).- x, y
number– Position of the swatch's top-left corner inside the ColorPicker, in unscaled pixels (converted to whole numbers).
Returns
Nothing.
Details
- The swatch has the ColorPicker's colour size (see ColorPickerGetColorSize).
- A swatch added this way does not use up a grid position: the next ColorPickerAddColor still goes to the same place it would have gone without it.
- The swatch is drawn fully opaque.
- The stock UI never calls this function.
Errors
The error messages spell the function name as ColorPickerAddColorAtPostion:
Error in function call 'ColorPickerAddColorAtPostion': Window %s does not existError in function call 'ColorPickerAddColorAtPostion': Window %s is not a ColorPicker
Example
A minimal example built from the signature:
ColorPickerAddColorAtPosition( "MyColorPicker", 255, 255, 255, 99, 0, 120 )
