plugins/kolab_tags
Aleksander Machniak
machniak at kolabsys.com
Tue Aug 5 14:38:36 CEST 2014
plugins/kolab_tags/kolab_tags.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 54cc9e9cb040e59ffa1dba2108d60bf579dd5461
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Tue Aug 5 05:51:05 2014 -0400
Fix so tag colors are always preserved (#3256)
diff --git a/plugins/kolab_tags/kolab_tags.js b/plugins/kolab_tags/kolab_tags.js
index e9332a2..592a592 100644
--- a/plugins/kolab_tags/kolab_tags.js
+++ b/plugins/kolab_tags/kolab_tags.js
@@ -618,18 +618,19 @@ function tag_box_element(tag, del_btn)
// set color style on tag box
function tag_set_color(obj, tag)
{
- var style = {backgroundColor: tag.color};
-
if (obj && tag.color) {
+ var style = 'background-color: ' + tag.color + ' !important';
+
// choose black text color when background is bright, white otherwise
if (/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i.test(tag.color)) {
// use information about brightness calculation found at
// http://javascriptrules.com/2009/08/05/css-color-brightness-contrast-using-javascript/
var brightness = (parseInt(RegExp.$1, 16) * 299 + parseInt(RegExp.$2, 16) * 587 + parseInt(RegExp.$3, 16) * 114) / 1000;
- style.color = brightness > 125 ? 'black' : 'white';
+ style += '; color: ' + (brightness > 125 ? 'black' : 'white') + ' !important';
}
- $(obj).css(style);
+ // don't use css() it does not work with "!important" flag
+ $(obj).attr('style', style);
}
}
More information about the commits
mailing list