A module for showing a color picker for easy picking and setting of colors.
Example usage:
var menu={
"Color Picker" : function(){
require("colorpicker").show({
onSelect:function(color){
print(color);
},
showPreview:true,
back:function(){
E.showMenu(menu);
}
});
}
}
E.showMenu(menu);Options:
require("colorpicker").show(opts) takes in an object of options, listed below:
colors: (Optional), specify a select list of colors to show instead of the default. Must not exceed 36 colors.showPreview: (Optional), choose whether or not to show a full-screen preview of the color you selected.onSelect: (Required), function that is called whenever the user changes the selection (selects or unselects a color). Saving logic goes here. In multi-select mode, this is called on every toggle and is passed the current list of selected colors.back: (Required), function that is called to return to previous state. Color picker listeners are automatically removed. This is called even after a color is selected and the menu automatically exits.multiSelect(Optional), if true, then the color picker allows the user to select multiple colors and returns a list of colors inonSelectstartingSelection(Optional, only for multi-select mode), array of colors selected at the start, for setting restoration.
RKBoss6