Skip to content

Instantly share code, notes, and snippets.

@ricealexander
Forked from bobspace/css_colors.js
Last active April 10, 2023 10:20
Show Gist options
  • Save ricealexander/e265e5bcd30c4637470715bd83c6a85c to your computer and use it in GitHub Desktop.
Save ricealexander/e265e5bcd30c4637470715bd83c6a85c to your computer and use it in GitHub Desktop.

Revisions

  1. Alex Rice revised this gist Nov 20, 2018. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion css_colors.js
    Original file line number Diff line number Diff line change
    @@ -160,7 +160,6 @@ const colorValues = [
    let result;

    // Generate a Random Color from this list

    const randomColor = ()=> {
    const index = Math.floor(Math.random() * colorValues.length);
    return colorValues[index];
  2. Alex Rice revised this gist Nov 20, 2018. 1 changed file with 5 additions and 7 deletions.
    12 changes: 5 additions & 7 deletions css_colors.js
    Original file line number Diff line number Diff line change
    @@ -160,14 +160,12 @@ const colorValues = [
    let result;

    // Generate a Random Color from this list
    class RandomColor {
    constructor() {
    const index = Math.floor(Math.random() * colorValues.length);
    this.name = colorValues[index].name;
    this.hex = colorValues[index].hex;
    }

    const randomColor = ()=> {
    const index = Math.floor(Math.random() * colorValues.length);
    return colorValues[index];
    }
    const newColor = new RandomColor;
    const newColor = randomColor();
    result = `${newColor.name} : ${newColor.hex}`;
    console.log(result); // Beige : #F5F5DC

  3. Alex Rice revised this gist Nov 19, 2018. No changes.
  4. Alex Rice revised this gist Nov 19, 2018. 1 changed file with 21 additions and 7 deletions.
    28 changes: 21 additions & 7 deletions css_colors.js
    Original file line number Diff line number Diff line change
    @@ -157,12 +157,26 @@ const colorValues = [
    {hex: "#9ACD32", name: "YellowGreen"}
    ];

    // Generate a Random Color
    const randomColor = Math.floor(Math.random() * colorValues.length);
    let result = `${colorValues[randomColor].name} : ${colorValues[randomColor].hex}`;
    console.log(result); // DarkOrchid : #9932CC
    let result;

    // Generate a Random Color from this list
    class RandomColor {
    constructor() {
    const index = Math.floor(Math.random() * colorValues.length);
    this.name = colorValues[index].name;
    this.hex = colorValues[index].hex;
    }
    }
    const newColor = new RandomColor;
    result = `${newColor.name} : ${newColor.hex}`;
    console.log(result); // Beige : #F5F5DC


    // Determine Hex Value of a known color
    const targetColor = "PaleTurquoise";
    result = colorValues.find(color => color.name === targetColor).hex;
    console.log(result); // #AFEEEE
    const getHex = (targetColor)=> {
    return colorValues
    .find(color => color.name.toLowerCase() === targetColor.toLowerCase())
    .hex;
    }
    result = getHex("PaleTurquoise");
    console.log(result); // #AFEEEE
  5. Alex Rice revised this gist Oct 5, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion css_colors.js
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ const colorValues = [
    {hex: "#BDB76B", name: "DarkKhaki"},
    {hex: "#8B008B", name: "DarkMagenta"},
    {hex: "#556B2F", name: "DarkOliveGreen"},
    {hex: "#FF8C00", name: "Darkorange"},
    {hex: "#FF8C00", name: "DarkOrange"},
    {hex: "#9932CC", name: "DarkOrchid"},
    {hex: "#8B0000", name: "DarkRed"},
    {hex: "#E9967A", name: "DarkSalmon"},
  6. Alex Rice revised this gist Oct 5, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions css_colors.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,11 @@
    // CSS Color Names
    // Compiled by @bobspace

    // Updates by @ricealexander
    // added Rebecca Purple
    // associates color names with their hex values
    // random color and locating a color in the array by its name

    const colorValues = [
    {hex: "#F0F8FF", name: "AliceBlue"},
    {hex: "#FAEBD7", name: "AntiqueWhite"},
  7. Alex Rice revised this gist Oct 5, 2018. No changes.
  8. Alex Rice revised this gist Oct 5, 2018. 1 changed file with 159 additions and 8 deletions.
    167 changes: 159 additions & 8 deletions css_colors.js
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,163 @@
    // CSS Color Names
    // Compiled by @bobspace

    // Revised by @heliosanctus
    // Added RebeccaPurple
    // Added Color Values array
    var colorNames = ["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","DarkGrey","DarkGreen","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","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","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"];
    var colorValues = ["#F0F8FF","#FAEBD7","#00FFFF","#7FFFD4","#F0FFFF","#F5F5DC","#FFE4C4","#000000","#FFEBCD","#0000FF","#8A2BE2","#A52A2A","#DEB887","#5F9EA0","#7FFF00","#D2691E","#FF7F50","#6495ED","#FFF8DC","#DC143C","#00FFFF","#00008B","#008B8B","#B8860B","#A9A9A9","#A9A9A9","#006400","#BDB76B","#8B008B","#556B2F","#FF8C00","#9932CC","#8B0000","#E9967A","#8FBC8F","#483D8B","#2F4F4F","#2F4F4F","#00CED1","#9400D3","#FF1493","#00BFFF","#696969","#696969","#1E90FF","#B22222","#FFFAF0","#228B22","#FF00FF","#DCDCDC","#F8F8FF","#FFD700","#DAA520","#808080","#808080","#008000","#ADFF2F","#F0FFF0","#FF69B4","#CD5C5C","#4B0082","#FFFFF0","#F0E68C","#E6E6FA","#FFF0F5","#7CFC00","#FFFACD","#ADD8E6","#F08080","#E0FFFF","#FAFAD2","#D3D3D3","#D3D3D3","#90EE90","#FFB6C1","#FFA07A","#20B2AA","#87CEFA","#778899","#778899","#B0C4DE","#FFFFE0","#00FF00","#32CD32","#FAF0E6","#FF00FF","#800000","#66CDAA","#0000CD","#BA55D3","#9370DB","#3CB371","#7B68EE","#00FA9A","#48D1CC","#C71585","#191970","#F5FFFA","#FFE4E1","#FFE4B5","#FFDEAD","#000080","#FDF5E6","#808000","#6B8E23","#FFA500","#FF4500","#DA70D6","#EEE8AA","#98FB98","#AFEEEE","#DB7093","#FFEFD5","#FFDAB9","#CD853F","#FFC0CB","#DDA0DD","#B0E0E6","#800080","#663399","#FF0000","#BC8F8F","#4169E1","#8B4513","#FA8072","#F4A460","#2E8B57","#FFF5EE","#A0522D","#C0C0C0","#87CEEB","#6A5ACD","#708090","#708090","#FFFAFA","#00FF7F","#4682B4","#D2B48C","#008080","#D8BFD8","#FF6347","#40E0D0","#EE82EE","#F5DEB3","#FFFFFF","#F5F5F5","#FFFF00","#9ACD32"];
    const colorValues = [
    {hex: "#F0F8FF", name: "AliceBlue"},
    {hex: "#FAEBD7", name: "AntiqueWhite"},
    {hex: "#00FFFF", name: "Aqua"},
    {hex: "#7FFFD4", name: "Aquamarine"},
    {hex: "#F0FFFF", name: "Azure"},
    {hex: "#F5F5DC", name: "Beige"},
    {hex: "#FFE4C4", name: "Bisque"},
    {hex: "#000000", name: "Black"},
    {hex: "#FFEBCD", name: "BlanchedAlmond"},
    {hex: "#0000FF", name: "Blue"},
    {hex: "#8A2BE2", name: "BlueViolet"},
    {hex: "#A52A2A", name: "Brown"},
    {hex: "#DEB887", name: "BurlyWood"},
    {hex: "#5F9EA0", name: "CadetBlue"},
    {hex: "#7FFF00", name: "Chartreuse"},
    {hex: "#D2691E", name: "Chocolate"},
    {hex: "#FF7F50", name: "Coral"},
    {hex: "#6495ED", name: "CornflowerBlue"},
    {hex: "#FFF8DC", name: "Cornsilk"},
    {hex: "#DC143C", name: "Crimson"},
    {hex: "#00FFFF", name: "Cyan"},
    {hex: "#00008B", name: "DarkBlue"},
    {hex: "#008B8B", name: "DarkCyan"},
    {hex: "#B8860B", name: "DarkGoldenRod"},
    {hex: "#A9A9A9", name: "DarkGray"},
    {hex: "#A9A9A9", name: "DarkGrey"},
    {hex: "#006400", name: "DarkGreen"},
    {hex: "#BDB76B", name: "DarkKhaki"},
    {hex: "#8B008B", name: "DarkMagenta"},
    {hex: "#556B2F", name: "DarkOliveGreen"},
    {hex: "#FF8C00", name: "Darkorange"},
    {hex: "#9932CC", name: "DarkOrchid"},
    {hex: "#8B0000", name: "DarkRed"},
    {hex: "#E9967A", name: "DarkSalmon"},
    {hex: "#8FBC8F", name: "DarkSeaGreen"},
    {hex: "#483D8B", name: "DarkSlateBlue"},
    {hex: "#2F4F4F", name: "DarkSlateGray"},
    {hex: "#2F4F4F", name: "DarkSlateGrey"},
    {hex: "#00CED1", name: "DarkTurquoise"},
    {hex: "#9400D3", name: "DarkViolet"},
    {hex: "#FF1493", name: "DeepPink"},
    {hex: "#00BFFF", name: "DeepSkyBlue"},
    {hex: "#696969", name: "DimGray"},
    {hex: "#696969", name: "DimGrey"},
    {hex: "#1E90FF", name: "DodgerBlue"},
    {hex: "#B22222", name: "FireBrick"},
    {hex: "#FFFAF0", name: "FloralWhite"},
    {hex: "#228B22", name: "ForestGreen"},
    {hex: "#FF00FF", name: "Fuchsia"},
    {hex: "#DCDCDC", name: "Gainsboro"},
    {hex: "#F8F8FF", name: "GhostWhite"},
    {hex: "#FFD700", name: "Gold"},
    {hex: "#DAA520", name: "GoldenRod"},
    {hex: "#808080", name: "Gray"},
    {hex: "#808080", name: "Grey"},
    {hex: "#008000", name: "Green"},
    {hex: "#ADFF2F", name: "GreenYellow"},
    {hex: "#F0FFF0", name: "HoneyDew"},
    {hex: "#FF69B4", name: "HotPink"},
    {hex: "#CD5C5C", name: "IndianRed"},
    {hex: "#4B0082", name: "Indigo"},
    {hex: "#FFFFF0", name: "Ivory"},
    {hex: "#F0E68C", name: "Khaki"},
    {hex: "#E6E6FA", name: "Lavender"},
    {hex: "#FFF0F5", name: "LavenderBlush"},
    {hex: "#7CFC00", name: "LawnGreen"},
    {hex: "#FFFACD", name: "LemonChiffon"},
    {hex: "#ADD8E6", name: "LightBlue"},
    {hex: "#F08080", name: "LightCoral"},
    {hex: "#E0FFFF", name: "LightCyan"},
    {hex: "#FAFAD2", name: "LightGoldenRodYellow"},
    {hex: "#D3D3D3", name: "LightGray"},
    {hex: "#D3D3D3", name: "LightGrey"},
    {hex: "#90EE90", name: "LightGreen"},
    {hex: "#FFB6C1", name: "LightPink"},
    {hex: "#FFA07A", name: "LightSalmon"},
    {hex: "#20B2AA", name: "LightSeaGreen"},
    {hex: "#87CEFA", name: "LightSkyBlue"},
    {hex: "#778899", name: "LightSlateGray"},
    {hex: "#778899", name: "LightSlateGrey"},
    {hex: "#B0C4DE", name: "LightSteelBlue"},
    {hex: "#FFFFE0", name: "LightYellow"},
    {hex: "#00FF00", name: "Lime"},
    {hex: "#32CD32", name: "LimeGreen"},
    {hex: "#FAF0E6", name: "Linen"},
    {hex: "#FF00FF", name: "Magenta"},
    {hex: "#800000", name: "Maroon"},
    {hex: "#66CDAA", name: "MediumAquaMarine"},
    {hex: "#0000CD", name: "MediumBlue"},
    {hex: "#BA55D3", name: "MediumOrchid"},
    {hex: "#9370DB", name: "MediumPurple"},
    {hex: "#3CB371", name: "MediumSeaGreen"},
    {hex: "#7B68EE", name: "MediumSlateBlue"},
    {hex: "#00FA9A", name: "MediumSpringGreen"},
    {hex: "#48D1CC", name: "MediumTurquoise"},
    {hex: "#C71585", name: "MediumVioletRed"},
    {hex: "#191970", name: "MidnightBlue"},
    {hex: "#F5FFFA", name: "MintCream"},
    {hex: "#FFE4E1", name: "MistyRose"},
    {hex: "#FFE4B5", name: "Moccasin"},
    {hex: "#FFDEAD", name: "NavajoWhite"},
    {hex: "#000080", name: "Navy"},
    {hex: "#FDF5E6", name: "OldLace"},
    {hex: "#808000", name: "Olive"},
    {hex: "#6B8E23", name: "OliveDrab"},
    {hex: "#FFA500", name: "Orange"},
    {hex: "#FF4500", name: "OrangeRed"},
    {hex: "#DA70D6", name: "Orchid"},
    {hex: "#EEE8AA", name: "PaleGoldenRod"},
    {hex: "#98FB98", name: "PaleGreen"},
    {hex: "#AFEEEE", name: "PaleTurquoise"},
    {hex: "#DB7093", name: "PaleVioletRed"},
    {hex: "#FFEFD5", name: "PapayaWhip"},
    {hex: "#FFDAB9", name: "PeachPuff"},
    {hex: "#CD853F", name: "Peru"},
    {hex: "#FFC0CB", name: "Pink"},
    {hex: "#DDA0DD", name: "Plum"},
    {hex: "#B0E0E6", name: "PowderBlue"},
    {hex: "#800080", name: "Purple"},
    {hex: "#663399", name: "RebeccaPurple"},
    {hex: "#FF0000", name: "Red"},
    {hex: "#BC8F8F", name: "RosyBrown"},
    {hex: "#4169E1", name: "RoyalBlue"},
    {hex: "#8B4513", name: "SaddleBrown"},
    {hex: "#FA8072", name: "Salmon"},
    {hex: "#F4A460", name: "SandyBrown"},
    {hex: "#2E8B57", name: "SeaGreen"},
    {hex: "#FFF5EE", name: "SeaShell"},
    {hex: "#A0522D", name: "Sienna"},
    {hex: "#C0C0C0", name: "Silver"},
    {hex: "#87CEEB", name: "SkyBlue"},
    {hex: "#6A5ACD", name: "SlateBlue"},
    {hex: "#708090", name: "SlateGray"},
    {hex: "#708090", name: "SlateGrey"},
    {hex: "#FFFAFA", name: "Snow"},
    {hex: "#00FF7F", name: "SpringGreen"},
    {hex: "#4682B4", name: "SteelBlue"},
    {hex: "#D2B48C", name: "Tan"},
    {hex: "#008080", name: "Teal"},
    {hex: "#D8BFD8", name: "Thistle"},
    {hex: "#FF6347", name: "Tomato"},
    {hex: "#40E0D0", name: "Turquoise"},
    {hex: "#EE82EE", name: "Violet"},
    {hex: "#F5DEB3", name: "Wheat"},
    {hex: "#FFFFFF", name: "White"},
    {hex: "#F5F5F5", name: "WhiteSmoke"},
    {hex: "#FFFF00", name: "Yellow"},
    {hex: "#9ACD32", name: "YellowGreen"}
    ];

    // Added random color
    var randColor = Math.floor(Math.random() * 148);
    alert ( colorNames[randColor] + " : " + colorValues[randColor] );
    // Generate a Random Color
    const randomColor = Math.floor(Math.random() * colorValues.length);
    let result = `${colorValues[randomColor].name} : ${colorValues[randomColor].hex}`;
    console.log(result); // DarkOrchid : #9932CC

    // Determine Hex Value of a known color
    const targetColor = "PaleTurquoise";
    result = colorValues.find(color => color.name === targetColor).hex;
    console.log(result); // #AFEEEE
  9. Alex Rice revised this gist Apr 8, 2017. 1 changed file with 10 additions and 6 deletions.
    16 changes: 10 additions & 6 deletions css_colors.js
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,12 @@
    // CSS Color Names
    // Compiled by @bobspace.
    //
    // A javascript array containing all of the color names listed in the CSS Spec.
    // The full list can be found here: http://www.w3schools.com/cssref/css_colornames.asp
    // Use it as you please, 'cuz you can't, like, own a color, man.
    // Compiled by @bobspace

    var CSS_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","DarkGrey","DarkGreen","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","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","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","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"];
    // Revised by @heliosanctus
    // Added RebeccaPurple
    // Added Color Values array
    var colorNames = ["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","DarkGrey","DarkGreen","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","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","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"];
    var colorValues = ["#F0F8FF","#FAEBD7","#00FFFF","#7FFFD4","#F0FFFF","#F5F5DC","#FFE4C4","#000000","#FFEBCD","#0000FF","#8A2BE2","#A52A2A","#DEB887","#5F9EA0","#7FFF00","#D2691E","#FF7F50","#6495ED","#FFF8DC","#DC143C","#00FFFF","#00008B","#008B8B","#B8860B","#A9A9A9","#A9A9A9","#006400","#BDB76B","#8B008B","#556B2F","#FF8C00","#9932CC","#8B0000","#E9967A","#8FBC8F","#483D8B","#2F4F4F","#2F4F4F","#00CED1","#9400D3","#FF1493","#00BFFF","#696969","#696969","#1E90FF","#B22222","#FFFAF0","#228B22","#FF00FF","#DCDCDC","#F8F8FF","#FFD700","#DAA520","#808080","#808080","#008000","#ADFF2F","#F0FFF0","#FF69B4","#CD5C5C","#4B0082","#FFFFF0","#F0E68C","#E6E6FA","#FFF0F5","#7CFC00","#FFFACD","#ADD8E6","#F08080","#E0FFFF","#FAFAD2","#D3D3D3","#D3D3D3","#90EE90","#FFB6C1","#FFA07A","#20B2AA","#87CEFA","#778899","#778899","#B0C4DE","#FFFFE0","#00FF00","#32CD32","#FAF0E6","#FF00FF","#800000","#66CDAA","#0000CD","#BA55D3","#9370DB","#3CB371","#7B68EE","#00FA9A","#48D1CC","#C71585","#191970","#F5FFFA","#FFE4E1","#FFE4B5","#FFDEAD","#000080","#FDF5E6","#808000","#6B8E23","#FFA500","#FF4500","#DA70D6","#EEE8AA","#98FB98","#AFEEEE","#DB7093","#FFEFD5","#FFDAB9","#CD853F","#FFC0CB","#DDA0DD","#B0E0E6","#800080","#663399","#FF0000","#BC8F8F","#4169E1","#8B4513","#FA8072","#F4A460","#2E8B57","#FFF5EE","#A0522D","#C0C0C0","#87CEEB","#6A5ACD","#708090","#708090","#FFFAFA","#00FF7F","#4682B4","#D2B48C","#008080","#D8BFD8","#FF6347","#40E0D0","#EE82EE","#F5DEB3","#FFFFFF","#F5F5F5","#FFFF00","#9ACD32"];

    // Added random color
    var randColor = Math.floor(Math.random() * 148);
    alert ( colorNames[randColor] + " : " + colorValues[randColor] );
  10. @bobspace bobspace created this gist May 16, 2012.
    8 changes: 8 additions & 0 deletions css_colors.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    // CSS Color Names
    // Compiled by @bobspace.
    //
    // A javascript array containing all of the color names listed in the CSS Spec.
    // The full list can be found here: http://www.w3schools.com/cssref/css_colornames.asp
    // Use it as you please, 'cuz you can't, like, own a color, man.

    var CSS_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","DarkGrey","DarkGreen","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","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","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","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"];