Skip to content
Jaliborc edited this page Jul 17, 2012 · 8 revisions

ColorPicker is a checkbutton class which inherits from CheckButton and provides an interface for selecting color and alpha values.

Methods

Name Description
SetColor(r,g,b,[a]), SetValue(r,g,b,[a]) Sets the selected color in the picker using RGB code. If alpha is enabled, a RGBA code should be provided instead. All values ranges from 0 to 1
GetColor(), GetValue() Returns the selected color and alpha in the picker as explained in "SetColor".
EnableAlpha(enable) If true, the picker will allow the user to select an extra alpha value, in addition to the color. Disabled by default.
HasAlpha () Returns true if alpha is enabled.

Calls

Name Description
OnColorChanged (r,g,b,[a]), OnInput (r,g,b,[a]) Fired when a new color or alpha is selected by the user. Passes the same values as explained in "SetColor".
OnUpdate Fired when a new color or alpha is selected by the user, after the other calls have been made.

Example

myPicker = SushiColorPicker()
myPicker:SetLabel('Lipstick Color')
myPicker:EnableAlpha(false)

myPicker:SetCall('OnColorChanged', function(myPicker, r,g,b)
	if r > .8 then
		print("Too much red.")
	elseif g < .4 then
		print("Just a little greener, please?")
	else
		print("That is a beautiful color!")
	end
end)

Sushi-3.1 🍣

Documentation
Class Reference
Best Practices

Feedback
Post an issue

Clone this wiki locally