Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ColorPickerGetColorAtPoint

From RoR Wiki
Revision as of 19:41, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · ColorPicker functions
Version: WAR 1.4.8

Returns the colour swatch under a point of a ColorPicker.

color = ColorPickerGetColorAtPoint(colorPickerName, x, y)

Arguments

colorPickerName
string – Name of the ColorPicker.
x, y
number – The point, in the same coordinates that the ColorPicker's mouse event handlers (for example OnLButtonUp( flags, x, y )) receive.

Returns

color
table – The swatch at the point, or nothing if there is none. Fields:
Key Type Meaning
r, g, b number Colour components, 0–255.
id number The id given when the colour was added.
x, y number The swatch's position in the picker, in unscaled pixels.

Details

  • When no swatch is at the point, the function returns no value, so color is nil. Test for that before using it.
  • Swatches are checked in the order they were added; the first one containing the point is returned.

Errors

  • Error in function call 'ColorPickerGetColorAtPoint': Window %s does not exist
  • Error in function call 'ColorPickerGetColorAtPoint': Window %s is not a ColorPicker

Example

From ChatOptionsWindow.OnLButtonUpColorPicker in default/ea_chatwindow/source/chatoptionswindow.lua:

local color = ColorPickerGetColorAtPoint( "ChatOptionsWindowColorPicker", x, y )
if (color ~= nil)
then
    LabelSetTextColor("ChatOptionsWindowListRow"..ChatOptionsWindow.SelectedMessageTypeWindowIndex.."ChannelName",
                      color.r,
                      color.g,
                      color.b)
end

See also