$conditional = new Conditional();
$conditional ->setConditionType(Conditional::CONDITION_CELLIS);
$conditional ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL);
$conditional ->addCondition(0);
$conditional ->getStyle()->applyFromArray([
"fill" => [
"type" => Fill::FILL_SOLID,
"color" => ["rgb" => "000000"]
]
]);
The above code will not change the background color.
startcolor will not work either but endcolor will
For the case that somebody comes here with the same problem but has set the fill color this way:
$conditional->getStyle()->getFill()->setFillType(Fill::FILL_SOLID);
$conditional->getStyle()->getFill()->getStartColor()->setARGB(Color::COLOR_GREEN);
Just add the following line:
$conditional->getStyle()->getFill()->getEndColor()->setARGB(Color::COLOR_GREEN);
Then it should work ;-)
Thank you @naitsirch for your comment. Has same problem. Works with from applyFromArray() too.
protected function setFill($color)
{
return [
'fill' => [
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'startColor' => [
'argb' => $color,
],
'endColor' => [
'argb' => $color,
],
],
];
}
Most helpful comment
For the case that somebody comes here with the same problem but has set the fill color this way:
Just add the following line:
Then it should work ;-)