define([ "require", // require.toUrl "dojo/text!./templates/ColorPalette.html", "./_Widget", // used also to load dijit/hccss for setting has("highcontrast") "./_TemplatedMixin", "./_PaletteMixin", "./hccss", // has("highcontrast") "dojo/i18n", // i18n.getLocalization "dojo/_base/Color", // dojo.Color dojo.Color.named "dojo/_base/declare", // declare "dojo/dom-construct", // domConstruct.place "dojo/string", // string.substitute "dojo/i18n!dojo/nls/colors", // translations "dojo/colors" // extend dojo.Color w/names of other colors ], function(require, template, _Widget, _TemplatedMixin, _PaletteMixin, has, i18n, Color, declare, domConstruct, string){ // module: // dijit/ColorPalette var ColorPalette = declare("dijit.ColorPalette", [_Widget, _TemplatedMixin, _PaletteMixin], { // summary: // A keyboard accessible color-picking widget // description: // Grid showing various colors, so the user can pick a certain color. // Can be used standalone, or as a popup. // // example: // |
// // example: // | var picker = new dijit.ColorPalette({ },srcNode); // | picker.startup(); // palette: [const] String // Size of grid, either "7x10" or "3x4". palette: "7x10", // _palettes: [protected] Map // This represents the value of the colors. // The first level is a hashmap of the different palettes available. // The next two dimensions represent the columns and rows of colors. _palettes: { "7x10": [ ["white", "seashell", "cornsilk", "lemonchiffon", "lightyellow", "palegreen", "paleturquoise", "lightcyan", "lavender", "plum"], ["lightgray", "pink", "bisque", "moccasin", "khaki", "lightgreen", "lightseagreen", "lightskyblue", "cornflowerblue", "violet"], ["silver", "lightcoral", "sandybrown", "orange", "palegoldenrod", "chartreuse", "mediumturquoise", "skyblue", "mediumslateblue", "orchid"], ["gray", "red", "orangered", "darkorange", "yellow", "limegreen", "darkseagreen", "royalblue", "slateblue", "mediumorchid"], ["dimgray", "crimson", "chocolate", "coral", "gold", "forestgreen", "seagreen", "blue", "blueviolet", "darkorchid"], ["darkslategray", "firebrick", "saddlebrown", "sienna", "olive", "green", "darkcyan", "mediumblue", "darkslateblue", "darkmagenta" ], ["black", "darkred", "maroon", "brown", "darkolivegreen", "darkgreen", "midnightblue", "navy", "indigo", "purple"] ], "3x4": [ ["white", "lime", "green", "blue"], ["silver", "yellow", "fuchsia", "navy"], ["gray", "red", "purple", "black"] ] }, // templateString: String // The template of this widget. templateString: template, baseClass: "dijitColorPalette", _dyeFactory: function(value, row, col, title){ // Overrides _PaletteMixin._dyeFactory(). return new this._dyeClass(value, row, col, title); }, buildRendering: function(){ // Instantiate the template, which makes a skeleton into which we'll insert a bunch of //