randomcolor
Advanced tools
Comparing version 0.4.4 to 0.5.0
@@ -13,3 +13,3 @@ { | ||
"description": "For generating attractive random colors", | ||
"license": "MIT", | ||
"license": "CC0", | ||
"main": "randomColor.js", | ||
@@ -16,0 +16,0 @@ "keywords": [ |
@@ -6,3 +6,3 @@ { | ||
"description": "For generating attractive random colors", | ||
"license": "MIT", | ||
"license": "CC0", | ||
"keywords": [ | ||
@@ -9,0 +9,0 @@ "attractive", |
{ | ||
"name": "randomcolor", | ||
"version": "0.4.4", | ||
"version": "0.5.0", | ||
"description": "For generating attractive random colors", | ||
@@ -23,3 +23,3 @@ "main": "randomColor.js", | ||
"author": "David Merfield", | ||
"license": "MIT", | ||
"license": "CC0", | ||
"bugs": { | ||
@@ -26,0 +26,0 @@ "url": "https://github.com/davidmerfield/randomColor/issues" |
@@ -44,3 +44,3 @@ // randomColor by David Merfield under the CC0 license | ||
// integer. Otherwise, reset the seed value. | ||
if (options.seed && options.seed === parseInt(options.seed, 10)) { | ||
if (options.seed !== undefined && options.seed !== null && options.seed === parseInt(options.seed, 10)) { | ||
seed = options.seed; | ||
@@ -186,3 +186,4 @@ | ||
var hslColor = HSVtoHSL(hsv); | ||
return 'hsla('+hslColor[0]+', '+hslColor[1]+'%, '+hslColor[2]+'%, ' + Math.random() + ')'; | ||
var alpha = options.alpha || Math.random(); | ||
return 'hsla('+hslColor[0]+', '+hslColor[1]+'%, '+hslColor[2]+'%, ' + alpha + ')'; | ||
@@ -198,3 +199,4 @@ case 'rgbArray': | ||
var rgbColor = HSVtoRGB(hsv); | ||
return 'rgba(' + rgbColor.join(', ') + ', ' + Math.random() + ')'; | ||
var alpha = options.alpha || Math.random(); | ||
return 'rgba(' + rgbColor.join(', ') + ', ' + alpha + ')'; | ||
@@ -201,0 +203,0 @@ default: |
@@ -12,3 +12,3 @@ # [Random Color](http://llllll.li/randomColor) | ||
``` | ||
randomColor has been ported to [C#](https://github.com/nathanpjones/randomColorSharped), [Go](https://github.com/hansrodtang/randomcolor), [PHP](https://github.com/mistic100/RandomColor.php), [Python](https://github.com/kevinwuhoo/randomcolor-py), [Swift](https://github.com/onevcat/RandomColorSwift), [Objective-C](https://github.com/yageek/randomColor), [Java](https://github.com/lzyzsd/AndroidRandomColor) and | ||
randomColor has been ported to [C#](https://github.com/nathanpjones/randomColorSharped), [C++](https://github.com/xuboying/randomcolor-cpp), [Go](https://github.com/hansrodtang/randomcolor), [PHP](https://github.com/mistic100/RandomColor.php), [Python](https://github.com/kevinwuhoo/randomcolor-py), [Swift](https://github.com/onevcat/RandomColorSwift), [Objective-C](https://github.com/yageek/randomColor), [Java](https://github.com/lzyzsd/AndroidRandomColor) and | ||
[R](https://github.com/ronammar/randomcoloR). | ||
@@ -28,4 +28,6 @@ | ||
**Format** – A string which specifies the format of the generated color. Possible values are ```rgb```, ```rgbArray```, ```hsl```, ```hslArray``` and ```hex``` (default). | ||
**Format** – A string which specifies the format of the generated color. Possible values are ```rgb```, ```rgba```, ```rgbArray```, ```hsl```, ```hsla```, ```hslArray``` and ```hex``` (default). | ||
**Alpha** – A decimal between 0 and 1 which specifies the alpha amount of ```rgba``` and ```hsla``` formats. Defaults to a random value. | ||
### Examples | ||
@@ -68,2 +70,9 @@ | ||
// Returns a dark RGB color with specified alpha | ||
randomColor({ | ||
luminosity: 'dark', | ||
format: 'rgba', | ||
alpha: 0.5 // e.g. 'rgba(9, 1, 107, 0.5)', | ||
}); | ||
// Returns a light HSL color with random alpha | ||
@@ -70,0 +79,0 @@ randomColor({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
66702
0
568
101
1