ColorPicker is an addon for choosing colors. It is used by other addons to allow users to select and modify colors. ColorPicker provides a simple API that brings up a dialog box with a color wheel for clicking on hues, an inset square for clicking on saturation/brightness, and text boxes for entering r, g, b, and hex values. There is also a slider and text box for setting alpha values when appropriate.
To facilitate sharing colors between addons, ColorPicker includes copy and paste buttons with a visible color swatch showing the copied color (only after one has been copied). Also, holding the control key down enables snap-to-color when clicking on the color wheel or saturation/brightness square, making it easier to select "pure" colors (a hint is displayed when snap-to-color is enabled so users aren't surprised by the feature). In this version, the API consists of a single function:
ColorPicker.AdjustCColor(color, hasAlpha, callback, arg)
The first parameter color is an object of type CColor. The dialog box adjusts this object in place which means that you can see changes reflected dynamically in your addon's display.
The second parameter hasAlpha is a boolean and when it is true the dialog shows the controls for adjusting alpha, otherwise it hides them.
The (optional) third parameter callback is a function that is called with the fourth parameter arg as argument whenever color may have changed. In some applications, this may be needed to update display objects with the current color.
ColorPicker can be tested with the command /colorpicker, which brings up the dialog with a sample color. We welcome feedback from both user and addon authors who try ColorPicker!
ColorPicker was originally written by Tomber and retains all rights reserved. Tomber has given Casstiel permission to distribute and support ColorPicker during his hiatus from Wildstar. ColorPicker bears a family resemblance to the WoW addon ColorPickerPlus by Jaslm. Jaslm shares credit as author of ColorPicker; she is responsible for the overall graphical design and in many ways ColorPicker borrows liberally from ColorPickerPlus.