set color of text of category tag by calculating brightness of bgcolor

This commit is contained in:
Uwe Steinmann 2021-07-14 20:24:52 +02:00
parent 45b3e55e66
commit 4b0db80304

View File

@ -3089,8 +3089,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
if($categories = $document->getCategories()) {
$content .= "<br />";
foreach($categories as $category)
$content .= "<span class=\"badge bg-secondary\"".($category->getColor() ? ' style="background-color: '.$category->getColor().' !important;"' : '').">".$category->getName()."</span> ";
foreach($categories as $category) {
$content .= "<span class=\"badge bg-secondary\"".($category->getColor() ? ' style="background-color: '.$category->getColor().' !important; color: '.(getColorBrightness($category->getColor()) < 0.8 ? 'white' : 'black').';"' : '').">".$category->getName()."</span> ";
}
}
if(!empty($extracontent['bottom_title']))
$content .= $extracontent['bottom_title'];