Adjust brightness for different event type colors
This commit is contained in:
parent
65203fddcf
commit
6f1cb6f1f3
|
@ -29,10 +29,9 @@ class HistoryColorGrid extends AbstractWidget {
|
|||
|
||||
private $start = null;
|
||||
private $end = null;
|
||||
|
||||
private $data = array();
|
||||
|
||||
private $color;
|
||||
public $opacity = 1.0;
|
||||
|
||||
public function __construct($color = '#51e551', $start = null, $end = null) {
|
||||
$this->setColor($color);
|
||||
|
@ -90,6 +89,16 @@ class HistoryColorGrid extends AbstractWidget {
|
|||
$this->color = $color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the used opacity
|
||||
*
|
||||
* @param $opacity
|
||||
*/
|
||||
public function setOpacity($opacity)
|
||||
{
|
||||
$this->opacity = $opacity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the color to display for the given value.
|
||||
*
|
||||
|
@ -115,13 +124,14 @@ class HistoryColorGrid extends AbstractWidget {
|
|||
if (array_key_exists($day, $this->data)) {
|
||||
$entry = $this->data[$day];
|
||||
return'<a ' .
|
||||
'style="background-color:' . $this->calculateColor($entry['value']) . ';" ' .
|
||||
'style="background-color:' . $this->calculateColor($entry['value']) . '; '
|
||||
. ' opacity: ' . $this->opacity . ';"' .
|
||||
'title="' . $entry['caption'] . '" ' .
|
||||
'href="' . $entry['url'] . '"' .
|
||||
'> </a>';
|
||||
} else {
|
||||
return '<a ' .
|
||||
'style="background-color:' . $this->calculateColor(0) . ';" ' .
|
||||
'style="background-color:' . $this->calculateColor(0) . '; ' . ' opacity: ' . $this->opacity . ';' .
|
||||
'title="No entries for ' . $day . '" ' .
|
||||
'></a>';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue