diff --git a/README.md b/README.md index af869bc..a70864d 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,13 @@ var color = randomColor(); // a hex code for an attractive color You can pass an options object to influence the type of color it produces. The options object accepts the following properties: -```hue``` – Controls the hue of the generated color. You can pass a string representing a color name: ```red```, ```orange```, ```yellow```, ```green```, ```blue```, ```purple```, ```pink``` and ```monochrome``` are currently supported. If you pass a hexidecimal color string such as ```#00FFFF```, randomColor will extract its hue value and use that to generate colors. +```hue``` – Controls the hue of the generated color. You can pass a string representing a color name: ```red```, ```orange```, ```yellow```, ```green```, ```blue```, ```purple```, ```pink``` and ```monochrome``` are currently supported. If you pass a hexadecimal color string such as ```#00FFFF```, randomColor will extract its hue value and use that to generate colors. -```luminosity``` – Controls the luminosity of the generated color. You can specify a string containing ```bright```, ```light``` or ```dark```. +```luminosity``` – Controls the luminosity of the generated color. You can specify a string containing ```bright```, ```light```, ```dark``` or ```muted```. ```count``` – An integer which specifies the number of colors to generate. -```seed``` - An integer or string which when passed will cause randomColor to return the same color each time. +```seed``` - An integer or string which, when passed, will cause randomColor to return the same color each time. ```format``` – A string which specifies the format of the generated color. Possible values are ```rgb```, ```rgba```, ```rgbArray```, ```hsl```, ```hsla```, ```hslArray``` and ```hex``` (default). diff --git a/randomColor.js b/randomColor.js index 2f26a39..cede90b 100644 --- a/randomColor.js +++ b/randomColor.js @@ -32,7 +32,7 @@ // Populate the color dictionary loadColorBounds(); - // check if a range is taken + // Check if a range is taken var colorRanges = []; var randomColor = function (options) { @@ -51,7 +51,7 @@ } else if (typeof options.seed === "string") { seed = stringToInteger(options.seed); - // Something was passed as a seed but it wasn't an integer or string + // Something was passed as a seed, but it wasn't an integer or string } else if (options.seed !== undefined && options.seed !== null) { throw new TypeError("The seed value must be an integer or string"); @@ -133,7 +133,7 @@ var hueRange = getHueRange(options.hue); hue = randomWithin(hueRange); - // Instead of storing red as two seperate ranges, + // Instead of storing red as two separate ranges, // we group them, using negative numbers if (hue < 0) { hue = 360 + hue; @@ -167,6 +167,7 @@ break; case "light": + case "muted": sMax = 55; break; } @@ -313,7 +314,7 @@ function randomWithin(range) { if (seed === null) { - //generate random evenly destinct number from : https://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ + //generate random evenly distinct number from: https://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ var golden_ratio = 0.618033988749895; var r = Math.random(); r += golden_ratio; @@ -368,7 +369,7 @@ defineColor( "red", - [-26, 18], + [-26, 18],//360-26=334 [ [20, 100], [30, 92], @@ -583,7 +584,7 @@ return total; } - // get The range of given hue when options.count!=0 + // get the range of given hue when options.count!=0 function getRealHueRange(colorHue) { if (!isNaN(colorHue)) { var number = parseInt(colorHue);