Merge pull request #4636 from aternatik/label_cat
FIX : check contrast of link when using background color for category
This commit is contained in:
commit
6c7fc55988
@ -1362,7 +1362,14 @@ class Categorie extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
|
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
// Check contrast with background and correct text color
|
||||||
|
$color = colorArrayToHex(colorStringToArray($this->color,array()),'');
|
||||||
|
$forced_color='000';
|
||||||
|
$tmpcolorweight=0;
|
||||||
|
foreach(colorStringToArray($color,array()) as $x) $tmpcolorweight+=$x;
|
||||||
|
if ($tmpcolorweight < 400) $forced_color='FFF';
|
||||||
|
|
||||||
|
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip"' . ( $forced_color ? ' style="color: #'.$forced_color.'"' : '' ) .'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='category';
|
$picto='category';
|
||||||
|
|||||||
@ -3661,10 +3661,10 @@ a span.select2-chosen
|
|||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
-webkit-box-shadow: none !important;
|
-webkit-box-shadow: none !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
color: #fff !important;
|
color: #fff;
|
||||||
}
|
}
|
||||||
span.noborderoncategories a, li.noborderoncategories a {
|
span.noborderoncategories a, li.noborderoncategories a {
|
||||||
color: #fff !important;
|
color: #fff;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user