colibris: fix coloring text when authorship background color is activated #3641

This commit is contained in:
Sebastian Castro 2020-04-16 08:20:57 +02:00 committed by muxator
parent 5e6ceb071e
commit 2193875292
3 changed files with 11 additions and 11 deletions

View file

@ -255,15 +255,9 @@ function Ace2Inner(){
authorStyle.backgroundColor = bgcolor;
parentAuthorStyle.backgroundColor = bgcolor;
// text contrast
if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5)
{
authorStyle.color = '#ffffff';
parentAuthorStyle.color = '#ffffff';
}else{
authorStyle.color = null;
parentAuthorStyle.color = null;
}
var textColor = colorutils.textColorFromBackgroundColor(bgcolor, parent.parent.clientVars.skinName);
authorStyle.color = textColor;
parentAuthorStyle.color = textColor;
// anchor text contrast
if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.55)

View file

@ -142,4 +142,12 @@ colorutils.complementary = function(c)
];
}
colorutils.textColorFromBackgroundColor = function(bgcolor, skinName)
{
var white = skinName == 'colibris' ? 'var(--super-light-color)' : '#fff';
var black = skinName == 'colibris' ? 'var(--super-dark-color)' : '#222';
return colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5 ? white : black;
}
exports.colorutils = colorutils;

View file

@ -84,8 +84,6 @@
margin-left: 15px;
width: 45px;
height: 100%;
background-color: var(--bg-color);
color: var(--text-color);
}
.toolbar ul li[data-key=showusers] > a {
width: 100%;