Merge pull request #349 from marcelklehr/master

Make text color change depending on luminosity of  author color
pull/373/merge
John McLear 2012-01-29 08:39:54 -08:00
commit 3287a0000a
1 changed files with 12 additions and 5 deletions

View File

@ -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;
}
}
}