From bbd4cf88bcb44c5155a7e61b053efc1f84bf1845 Mon Sep 17 00:00:00 2001 From: 7185 <7185@users.noreply.github.com> Date: Sun, 28 Sep 2014 05:55:10 +0200 Subject: [PATCH] Poster ID readability --- js/id_colors.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/id_colors.js b/js/id_colors.js index 2c6a5775..bfe2ef23 100644 --- a/js/id_colors.js +++ b/js/id_colors.js @@ -39,18 +39,22 @@ if (active_page == 'thread' || active_page == 'index') { function colorPostId(el) { 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); }); }