diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index e9784772..e28b11e4 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -236,12 +236,19 @@ function OUTER(gscope) { bgcolor = fadeColor(bgcolor, info.fade); } - - dynamicCSS.selectorStyle(getAuthorColorClassSelector( - getAuthorClassName(author))).backgroundColor = bgcolor; - dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( - getAuthorClassName(author))).backgroundColor = bgcolor; + // Text color + var txtcolor = (colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.45) ? '#ffffff' : '#000000'; + + var authorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector( + getAuthorClassName(author))); + authorStyle.backgroundColor = bgcolor; + authorStyle.color = txtcolor; + + var authorStyleTop = dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( + getAuthorClassName(author))); + authorStyleTop.backgroundColor = bgcolor; + authorStyleTop.color = txtcolor; } } }