2
0
mirror of https://github.com/PitPik/colorPicker.git synced 2025-08-10 10:42:45 -06:00

bugfix in color conversion

@Martin1887 discovered a bug in color conversion if hue is 0
This commit is contained in:
peterd 2014-10-14 22:00:20 +02:00
parent 54ff2e0159
commit 1870a7cf4a
6 changed files with 13 additions and 12 deletions

4
color.all.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -416,8 +416,9 @@
chroma = r - min;
s = r ? (chroma / r) : 0;
return {
h: s < 1e-15 ? ((_colors && _colors.hsl.h) || 0) : chroma ? Math.abs(k + (g - b) / (6 * chroma)) : 0,
s: r ? (chroma / r) : ((_colors && _colors.hsv.s) || 0), // ??_colors.hsv.s || 0
h: s < 1e-15 ? ((_colors && _colors.hsl && _colors.hsl.h) || 0) :
chroma ? Math.abs(k + (g - b) / (6 * chroma)) : 0,
s: r ? (chroma / r) : ((_colors && _colors.hsv && _colors.hsv.s) || 0), // ??_colors.hsv.s || 0
v: r
};
},
@ -450,7 +451,7 @@
return {
h: hsv.h,
s: !hsv.v && !s ? ((_colors && _colors.hsl.s) || 0) : s, // ???
s: !hsv.v && !s ? ((_colors && _colors.hs && _colors.hsl.s) || 0) : s, // ???
l: l / 2
};
},

File diff suppressed because one or more lines are too long

View File

@ -142,7 +142,7 @@
}
} else if (inputIndex !== -1) {
// ...
} else {
} else if (colorPickerUI) {
colorPickerUI.style.display = 'none';
}
};

File diff suppressed because one or more lines are too long