don't mutate values passed to Ox.rgb and Ox.hsl

This commit is contained in:
rolux 2011-11-30 15:33:49 +01:00
parent a6d4734bb3
commit 5209cf70d7

View file

@ -19,7 +19,7 @@ Ox.hsl = function(rgb) {
if (arguments.length == 3) {
rgb = Ox.makeArray(arguments);
}
rgb = rgb.map(function(val) {
rgb = Ox.clone(rgb).map(function(val) {
return val / 255;
});
var max = Ox.max(rgb),
@ -66,6 +66,7 @@ Ox.rgb = function(hsl) {
if (arguments.length == 3) {
hsl = Ox.makeArray(arguments);
}
hsl = Ox.clone(hsl);
hsl[0] /= 360;
var rgb = [0, 0, 0],
v1, v2, v3;