Skip to content

Commit

Permalink
bug fix for base colors with a hue and saturation of 0 returning reds
Browse files Browse the repository at this point in the history
  • Loading branch information
Fooidge committed Oct 24, 2014
1 parent feebad0 commit a65e72e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pleasejs",
"version": "0.3.0",
"version": "0.4.0",
"homepage": "https://github.com/Fooidge/PleaseJS",
"authors": [
"Fooidge"
Expand Down
4 changes: 2 additions & 2 deletions dist/Please.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pleasejs",
"version": "0.3.0",
"version": "0.4.0",
"description": "JS library to generate random pleasing colors/color schemes",
"main": ".dist/Please.js",
"scripts": {
Expand Down
10 changes: 8 additions & 2 deletions src/Please.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*!Please JS v0.3.0, Jordan Checkman 2014, Checkman.io, MIT License, Have fun.*/
/*!Please JS v0.4.0, Jordan Checkman 2014, Checkman.io, MIT License, Have fun.*/
(function( globalName, root, factory ) {
if ( typeof define === 'function' && define.amd ) {
define( [], factory );
Expand Down Expand Up @@ -580,7 +580,13 @@
value;
if( base_color !== null ){
hue = clamp( random_int( ( base_color.h - 5 ), ( base_color.h + 5 ), randomiser), 0, 360);
saturation = random_float( 0.4, 0.85, randomiser );
//fix for black/gray as a base color returning reds
if( base_color.s === 0 ) {
saturation = 0;
}
else{
saturation = random_float( 0.4, 0.85, randomiser );
}
value = random_float( 0.4, 0.85, randomiser );
color.push({
h: hue,
Expand Down

0 comments on commit a65e72e

Please sign in to comment.