34 lines
905 B
PHP
34 lines
905 B
PHP
<?php
|
|
function colorToStr(string $color): string {
|
|
switch ($color) {
|
|
case "":
|
|
case "#f1edeb": return "white";
|
|
case "#ff00ff": return "pink";
|
|
case "#48bd8d": return "green";
|
|
case "#8200ff": return "lila";
|
|
case "#ff6700": return "orange";
|
|
case "#000000": return "black";
|
|
}
|
|
}
|
|
|
|
function bg(string $bgColor, string $gridColor): string {
|
|
if ($gridColor == "") $gridColor = "#8200ff";
|
|
$bg = 'bg-' . colorToStr($bgColor) . '-' . colorToStr($gridColor);
|
|
remember($bg);
|
|
return $bg;
|
|
}
|
|
|
|
function remember(string $value): string {
|
|
static $oldValue = "bg-white-lila";
|
|
|
|
$copy = $oldValue;
|
|
$oldValue = $value;
|
|
|
|
return $copy;
|
|
}
|
|
|
|
function randomBg(): string {
|
|
static $colors = ["#f1edeb", "#ff00ff", "#48bd8d", "#8200ff", "#ff6700"];
|
|
$a = array_rand($colors, 2);
|
|
return bg($colors[$a[0]], $colors[$a[1]]);
|
|
} |