color category batch

This commit is contained in:
Uwe Steinmann 2023-02-22 10:01:06 +01:00
parent 05c0f296fc
commit ac3580aa1c
2 changed files with 8 additions and 4 deletions

View File

@ -3166,8 +3166,10 @@ $('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->getName()."</span> ";
foreach($categories as $category) {
$color = substr(md5($category->getName()), 0, 6);
$content .= "<span class=\"badge\" style=\"background-color: #".$color."; color: #".self::getContrastColor($color).";\">".$category->getName()."</span> ";
}
}
if(!empty($extracontent['bottom_title']))
$content .= $extracontent['bottom_title'];

View File

@ -3244,8 +3244,10 @@ $('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->getName()."</span> ";
foreach($categories as $category) {
$color = substr(md5($category->getName()), 0, 6);
$content .= "<span class=\"badge\" style=\"background-color: #".$color."; color: #".self::getContrastColor($color).";\">".$category->getName()."</span> ";
}
}
if(!empty($extracontent['bottom_title']))
$content .= $extracontent['bottom_title'];