Modules (188)

ColorUtils

Description

Utilities functions related to color matching

Dependencies

This module has no dependencies

Variables

Public API

COLOR_NAMES Constant

Sorted array of all the color names in the CSS Color Module Level 3 (http://www.w3.org/TR/css3-color/) and "rebeccapurple" from CSS Color Module Level 4

Type
@type Array
    var COLOR_NAMES = ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "grey", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"];

Functions

Public API

formatColorHint

Adds a color swatch to code hints where this is supported.

$hintObj non-nullable jQuery
list item where the swatch will be in
color nullable string
color the swatch should have, or null to add extra left margin to align with the other hints
Returns: jQuery
jQuery object with the correct class and/or style applied
    function formatColorHint($hintObj, color) {
        if (color) {
            $hintObj.prepend($("<span>")
                .addClass("color-swatch")
                .css("backgroundColor", color));
        } else {
            $hintObj.addClass("no-swatch-margin");
        }
        return $hintObj;
    }


    // Define public API
    exports.COLOR_NAMES     = COLOR_NAMES;
    exports.COLOR_REGEX     = COLOR_REGEX;
    exports.formatColorHint = formatColorHint;
});