[Pkg-javascript-commits] [jquery-minicolors] 32/46: Fix for issue #175
David Prévot
taffit at moszumanska.debian.org
Sun Oct 25 17:18:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository jquery-minicolors.
commit d11a08b72698d6c667c9f7259dbdf508a7628a25
Author: Cyril Rezé <cyril.reze at joomlic.com>
Date: Mon Oct 5 19:17:39 2015 +0200
Fix for issue #175
This PR is fixing issue reported here : https://github.com/claviska/jquery-minicolors/issues/175
In the same time, i have added the change by @harisrozak to allow alpha 0 when using <code>format rgb</code> and <code>opacity true</code>. In addition, a little change to set a rgba with opacity 1 when alpha 100%.
I have updated to the demo html to replace <code>hex</code> by <code>value</code> in the change Event function. (as not only a hex value is fired, better to use a common naming ;-) )
Thanks for testing! ;-)
Cyril
---
jquery.minicolors.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/jquery.minicolors.js b/jquery.minicolors.js
index 1a68fe1..e271f81 100644
--- a/jquery.minicolors.js
+++ b/jquery.minicolors.js
@@ -471,9 +471,9 @@
// Returns RGB(A) string
var rgb = hex2rgb(hex),
opacity = input.attr('data-opacity') === '' ? 1 : keepWithin( parseFloat( input.attr('data-opacity') ).toFixed(2), 0, 1 );
- if( isNaN( opacity ) ) opacity = 1;
+ if( isNaN( opacity ) || !settings.opacity ) opacity = 1;
- if( input.minicolors('rgbObject').a < 1 && rgb ) {
+ if( input.minicolors('rgbObject').a <= 1 && rgb && settings.opacity) {
// Set RGBA string if alpha
value = 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat( opacity ) + ')';
} else {
@@ -761,7 +761,7 @@
}
// Return RGBA string
- if( rgba[3] ) {
+ if(typeof(rgba[3]) !== 'undefined' && rgba[3] <= 1) {
return 'rgba(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ', ' + rgba[3] + ')';
} else {
return 'rgb(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ')';
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/jquery-minicolors.git
More information about the Pkg-javascript-commits
mailing list