The ColorPicker is a specialized UI element that allows you to add a number of colors to a single UI element.
| ColorPicker | The ColorPicker is a specialized UI element that allows you to add a number of colors to a single UI element. |
| XML Definition | This is the ColorPicker xml definition. |
| XML Tag | |
| Attributes | |
| texture | Name of the Ui Texture to display. |
| columnsPerRow | Allows you to specify how many colors you wish to have in a row. |
| Elements | |
| ColorTexCoords | The texture coordinates for the top left of the image on the texture. |
| ColorTexDims | The texture dimensions of the image to use for colors. |
| ColorSize | The width and height of each color. |
| ColorSpacing | The amount of space (in pixels) in between each color on the x and y. |
| Window Callbacks | These are the ColorPicker specific callback events. |
| Callbacks | |
| OnPointMouseOver | Called when the user mouses over a color point. |
| Functions | |
| ColorPickerGetCoordinatesForColor() | Retrieves a color based on a point clicked on the color picker. |
| ColorPickerGetColorAtPoint() | Retrieves a color based on a point clicked on the color picker. |
| ColorPickerGetColorById() | Retrieves a color based on a point clicked on the color picker. |
| ColorPickerCreateWithColorTable() | Creates a color |
| ColorPickerAddColor() | Creates a color |
| ColorPickerAddColorAtPosition() | Creates a color |
| ColorPickerClear() | Clear all the colors from a color picker. |
| ColorPickerGetColorSpacing() | Retrieves the color spacing of a given color picker. |
| ColorPickerGetTexDims() | Retrieves the color size of a given color picker. |
| ColorPickerGetColorSize() | Retrieves the color size of a given color picker. |
This is the ColorPicker xml definition.
| XML Tag | |
| Attributes | |
| texture | Name of the Ui Texture to display. |
| columnsPerRow | Allows you to specify how many colors you wish to have in a row. |
| Elements | |
| ColorTexCoords | The texture coordinates for the top left of the image on the texture. |
| ColorTexDims | The texture dimensions of the image to use for colors. |
| ColorSize | The width and height of each color. |
| ColorSpacing | The amount of space (in pixels) in between each color on the x and y. |
Allows you to specify how many colors you wish to have in a row.
An integer value.
The texture coordinates for the top left of the image on the texture.
<ColorTexCoords x="100" y="200" />
| x | The x pixel coordinate of the top left of the image. |
| y | The y pixel coordinate of the top left of the image. |
| x | 0 |
| y | 0 |
The texture dimensions of the image to use for colors. If no ColorTexDims are specified and a texture is specified
<ColorTexDims x="100" y="100" />
| x | The x pixel texture size. |
| y | The y pixel texture size. |
| x | 0 |
| y | 0 |
The width and height of each color.
<ColorSize x="100" y="100" />
| x | The x pixel color size. |
| y | The y pixel color size. |
| x | 1 |
| y | 1 |
The amount of space (in pixels) in between each color on the x and y.
<TexDims x="100" y="100" />
| x | The x amount of space. |
| y | The y amount of space. |
| x | 0 |
| y | 0 |
These are the ColorPicker specific callback events.
| Callbacks | |
| OnPointMouseOver | Called when the user mouses over a color point. |
| Functions | |
| ColorPickerGetCoordinatesForColor() | Retrieves a color based on a point clicked on the color picker. |
| ColorPickerGetColorAtPoint() | Retrieves a color based on a point clicked on the color picker. |
| ColorPickerGetColorById() | Retrieves a color based on a point clicked on the color picker. |
| ColorPickerCreateWithColorTable() | Creates a color |
| ColorPickerAddColor() | Creates a color |
| ColorPickerAddColorAtPosition() | Creates a color |
| ColorPickerClear() | Clear all the colors from a color picker. |
| ColorPickerGetColorSpacing() | Retrieves the color spacing of a given color picker. |
| ColorPickerGetTexDims() | Retrieves the color size of a given color picker. |
| ColorPickerGetColorSize() | Retrieves the color size of a given color picker. |
Called when the user mouses over a color point.
SomeMapWindow.OnPointMouseOver(r, g, b, id)
Retrieves a color based on a point clicked on the color picker.
| ColorPickerWindowName | (string) The name of the color picker. |
| r | (number) The r value of the color. |
| g | (number) The g value of the color. |
| b | (number) The b value of the color. |
| left, top | (number) Coordinates x,y position of the topleft point Color Rect on the Color Picker window. |
local left, top = ColorPickerGetCoordinatesForColor( “myColorPicker”, r, g, b )
Retrieves a color based on a point clicked on the color picker.
| ColorPickerWindowName | (string) The name of the color picker. |
| x | (number) The x position of the mouse click. |
| y | (number) The y position of the mouse click. |
| color | (table) containing the r, g, and b values of the color, the id and the x, y position of the top left of the color or nil if a color was not picked. |
local color = ColorPickerGetColorAtPoint( “myColorPicker”, x, y )
Retrieves a color based on a point clicked on the color picker.
| ColorPickerWindowName | (string) The name of the color picker. |
| Id | (number) The user specified Id of the color. |
| r | (number) The red value of the color. |
| g | (number) The green value of the color. |
| b | (number) The blue value of the color. |
| id | (number) The id of the color. |
| x | (number) The x postion of the color. |
| y | (number) The y postion of the color. |
Note:Will return nil if no color is found.
local color = ColorPickerGetColorById( “myColorPicker”, colorId )
Creates a color
| ColorPickerWindowName | (string) The name of the color picker. |
| Colors | (table) A table of color tables with color information (r, g, b) and their ids. The id is user defined and has no actually significance to the color picker, but it is a useful way to track colors in lua without having to compare each r, g, b values. Each color table can also contain optional x, y coordinates of the colors top left corner. The order with which the colors are placed is dependent upon the order of the table. Example: Colors = { {r=143, g=57, b=54, id=5 }, {r=50, g=10, b=113, id=17, x=100, y=200}, ... } |
| Stride | (number) The number of color columns per row. |
| OffsetX | (number) The amount of pixels between each color on the x axis. |
| OffsetY | (number) The amount of pixels between each color on the y axis. |
none
ColorPickerCreateWithColorTable( “myColorPicker”, Colors, 4, 5, 5 )
Creates a color
| ColorPickerWindowName | (string) The name of the color picker. |
| r | (number) the red value of the color (0 to 255). |
| g | (number) the green value of the color (0 to 255). |
| b | (number) the blue value of the color (0 to 255). |
| id | (number) a user defined id that can be specified with the color, these ids do not have to be unique. |
none
ColorPickerAddColor( “myColorPicker”, 115, 40, 213, 1 )
Creates a color
| ColorPickerWindowName | (string) The name of the color picker. |
| r | (number) the red value of the color (0 to 255). |
| g | (number) the green value of the color (0 to 255). |
| b | (number) the blue value of the color (0 to 255). |
| id | (number) a user defined id that can be specified with the color, these ids do not have to be unique. |
| x | (number) the left corner of where the color is to be positioned. |
| y | (number) the top corner of where the color is to be positioned. |
none
ColorPickerAddColorAtPosition( “myColorPicker”, 115, 40, 213, 1, 0, 0 )
Clear all the colors from a color picker.
| ColorPickerWindowName | (string) The name of the color picker. |
none
ColorPickerClear( “myColorPicker” )
Retrieves the color spacing of a given color picker.
| ColorPickerWindowName | (string) The name of the color picker. |
| x | (number) The x spacing of a single color in the color picker. |
| y | (number) The y spacing of a single color in the color picker. |
local x, y = ColorPickerGetColorSpacing( “myColorPicker” )
Retrieves the color size of a given color picker.
| ColorPickerWindowName | (string) The name of the color picker. |
| width | (number) The width of a single color’s texture in the color picker. |
| height | (number) The height of a single color’s texture in the color picker. |
local width, height = ColorPickerGetTexDims( “myColorPicker” )
Retrieves the color size of a given color picker.
| ColorPickerWindowName | (string) The name of the color picker. |
| width | (number) The width of a single color in the color picker. |
| height | (number) The height of a single color in the color picker. |
local width, height = ColorPickerGetColorSize( “myColorPicker” )