doti3/bar/src/base/block.php
2017-12-15 17:43:15 +01:00

33 lines
686 B
PHP

<?php
function color($label)
{
$colors = [
'music' => '#C3D4FF',
'date' => '#E9F1FF',
'info' => '#E9F1FF',
'critical' => '#FF474A',
'warning' => '#FF6836',
'normal' => '#B3FF6C',
];
return $colors[$label] ?? $colors['info'];
}
function block(string $name, array $options = [])
{
$options = array_merge(
[
'full_text' => '',
'align' => 'left',
'name' => $name,
'urgent' => false,
'separator' => true,
'separator_block_width' => 20,
],
$options
);
echo stripslashes(json_encode($options, JSON_UNESCAPED_UNICODE));
}