29 lines
611 B
PHP
29 lines
611 B
PHP
|
<?php
|
||
|
declare(strict_types = 1);
|
||
|
namespace Kimendisch\Sbgg_Jetzt;
|
||
|
|
||
|
// GET THEME COLOR TO USE //
|
||
|
$color_list_lookup = ["red", "orange", "yellow", "green", "cyan", "blue", "purple"];
|
||
|
|
||
|
// check cookie
|
||
|
$theme = $_COOKIE["theme"] ?? "";
|
||
|
|
||
|
// validate
|
||
|
if(!in_array($theme, $color_list_lookup, strict: true) and $theme !== "random"){
|
||
|
$theme = "green";
|
||
|
}
|
||
|
|
||
|
// random color
|
||
|
if($theme === "random") $theme = array_rand(array_flip($color_list_lookup));
|
||
|
?>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
:root {
|
||
|
--theme: var(--color-<?= $theme ?>);
|
||
|
--theme-light: var(--color-<?= $theme ?>-light);
|
||
|
--theme-dark: var(--color-<?= $theme ?>-dark);
|
||
|
}
|