Skip to content

Commit a65e72e

Browse files
committed
bug fix for base colors with a hue and saturation of 0 returning reds
1 parent feebad0 commit a65e72e

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pleasejs",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"homepage": "https://github.com/Fooidge/PleaseJS",
55
"authors": [
66
"Fooidge"

dist/Please.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pleasejs",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"description": "JS library to generate random pleasing colors/color schemes",
55
"main": ".dist/Please.js",
66
"scripts": {

src/Please.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*!Please JS v0.3.0, Jordan Checkman 2014, Checkman.io, MIT License, Have fun.*/
1+
/*!Please JS v0.4.0, Jordan Checkman 2014, Checkman.io, MIT License, Have fun.*/
22
(function( globalName, root, factory ) {
33
if ( typeof define === 'function' && define.amd ) {
44
define( [], factory );
@@ -580,7 +580,13 @@
580580
value;
581581
if( base_color !== null ){
582582
hue = clamp( random_int( ( base_color.h - 5 ), ( base_color.h + 5 ), randomiser), 0, 360);
583-
saturation = random_float( 0.4, 0.85, randomiser );
583+
//fix for black/gray as a base color returning reds
584+
if( base_color.s === 0 ) {
585+
saturation = 0;
586+
}
587+
else{
588+
saturation = random_float( 0.4, 0.85, randomiser );
589+
}
584590
value = random_float( 0.4, 0.85, randomiser );
585591
color.push({
586592
h: hue,

0 commit comments

Comments
 (0)