summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author7185 <7185@users.noreply.github.com>2014-09-28 05:55:10 +0200
committerczaks <marcin@6irc.net>2014-10-05 17:48:43 +0200
commitb34f9c31f9d950bd25045110fe78461bfa1304b5 (patch)
tree62155dbfb3ae2a2e446835c508a93cb5436c2b90
parent6133386b826758d03caf938b15266efa88ecb200 (diff)
Poster ID readability
Conflicts: js/id_colors.js
-rw-r--r--js/id_colors.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/js/id_colors.js b/js/id_colors.js
index bde2a969..f92113d8 100644
--- a/js/id_colors.js
+++ b/js/id_colors.js
@@ -24,19 +24,23 @@ if (active_page == 'thread' || active_page == 'index') {
}
function colorPostId(el) {
- var rgb = stringToRGB($(el).text());
-
+ var rgb = IDToRGB($(el).text());
+ var ft = "#fff";
+
+ if ((rgb[0]*0.299 + rgb[1]*0.587 + rgb[2]*0.114) > 125)
+ ft = "#000";
+
$(el).css({
"background-color": "rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")",
"padding": "0px 5px",
"border-radius": "8px",
- "color": "white"
+ "color": ft
});
$(el).mouseover(function() {
- $(this).css('color', '#800000');
+ $(this).css('color', '#800000'); // how about a CSS :hover rule instead?
}).mouseout(function() {
- $(this).css('color', '#FFF');
+ $(this).css('color', ft);
});
}