Fooidge/PleaseJS

make_color() returns "#00000.randomhex" when base_color: black

Opened this issue · 1 comments

So, my code is:

var csscolornames = ["AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure", "Beige", "Bisque", "Black",  "BlanchedAlmond", etc];
chex = Please.make_color({base_color: csscolornames[i]});
console.log("CHEX " + chex);
chsv = Please.HEX_to_HSV(String(chex));

Everything works except when chex is using base_color:black. The console.log chex shows: #000000.randomhex where "randomhex" is a relative black color (eg. #240000). The subsequent comand HEX_to_HSV fails as the String is not in actual HEX format. Also, I need to use HEX_to_HSV as apparently if I use format:'hsv' in make_color(), the object returned doesn't have any values stored (eg. h, s, v), so I can't access them (eg. chex.h, chex.s, chex.v), if I try to console.log chex it would be [Object] [object], but when I use HEX_to_HSV, the console.log chsv would show me eg. [Object] {h:98, s:.4, v:.5}.

A quick add, here is the complete list of colors that are bugged:
Black, DarkGrey, DarkGray, DimGrey, DimGray, Gainsboro, Gray, Grey, LightGray, LightGrey, Silver, White, WhiteSmoke.
I tried to run:

for(var z=0;z<csscolornames.length;z++){
        console.log(csscolornames[z]);
        console.log(Please.make_color({base_color: csscolornames[z]}));
    }

The result is similar to this:

Wheat
["#957a43"]
White
["#000000.73f6d13"]


LightGoldenRodYellow
["#a6aa2f"]
LightGray
["#000000.9556cdf"]
LightGrey
["#000000.d389aac"]
LightGreen
["#5c9e5a"]