From 49061175c9557b14132e95df5ad4959edf18af4f Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 22 Jan 2012 13:30:25 +0100 Subject: [PATCH] Text color changes based on author color --- static/js/ace2_inner.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index ec0d5dc4..6e61ac93 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -207,12 +207,22 @@ function OUTER(gscope) { bgcolor = fadeColor(bgcolor, info.fade); } - + + // Background dynamicCSS.selectorStyle(getAuthorColorClassSelector( getAuthorClassName(author))).backgroundColor = bgcolor; dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( getAuthorClassName(author))).backgroundColor = bgcolor; + + // Text color + var txtcolor = (colorutils.luminosity(bgcolor) < 0.45) ? 'ffffff' : '000000'; + + dynamicCSS.selectorStyle(getAuthorColorClassSelector( + getAuthorClassName(author))).color = txtcolor; + + dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( + getAuthorClassName(author))).color = txtcolor; } } }