Cofem/lib/dynamic_style.php

15 lines
467 B
PHP
Raw Normal View History

2024-02-05 21:21:04 +01:00
<?php
2024-04-27 11:48:58 +02:00
declare(strict_types=1);
2024-02-05 21:21:04 +01:00
function doDynamicStyling() :string
{
$dynamic_style = "";
if(isLoggedIn() && !empty($_SESSION["favorite_color"]) && is_int($_SESSION["favorite_color"]) && $_SESSION["favorite_color"] <= 4294967295){
$dynamic_style = "<style>";
$color = dechex($_SESSION["favorite_color"]);
$dynamic_style .= "--root{ --favorite-color: #$color;";
$dynamic_style .= "</style>";
}
return $dynamic_style;
}