From 4b0db80304f50d6ba16807598bd885c6755d2ed1 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 14 Jul 2021 20:24:52 +0200 Subject: [PATCH] set color of text of category tag by calculating brightness of bgcolor --- views/bootstrap/class.Bootstrap.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 8412bbcd6..533acf863 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -3089,8 +3089,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) if($categories = $document->getCategories()) { $content .= "
"; - foreach($categories as $category) - $content .= "getColor() ? ' style="background-color: '.$category->getColor().' !important;"' : '').">".$category->getName()." "; + foreach($categories as $category) { + $content .= "getColor() ? ' style="background-color: '.$category->getColor().' !important; color: '.(getColorBrightness($category->getColor()) < 0.8 ? 'white' : 'black').';"' : '').">".$category->getName()." "; + } } if(!empty($extracontent['bottom_title'])) $content .= $extracontent['bottom_title'];