false
];
require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/travelling.inc"; global $travelling;
require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/score.inc";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/banner.inc";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc";
?>
= $title && $title !== "-" ? $title . " ยท " : "" ?>Ponycule
");
echo("Color difference debug\n======================\n\n");
echo("Color: #" . $member["color"] . "\n\n");
}
$sr = hexdec(substr($color, 0, 2));
$sg = hexdec(substr($color, 2, 2));
$sb = hexdec(substr($color, 4, 2));
$differencesAll = [];
foreach ($palettes["list"] as $id => $palette) {
$colors = [
...explode(",", $palette["dark"]),
...explode(",", $palette["light"])
];
$importantColors = [
$colors[5],
$colors[9],
$colors[15],
$colors[19]
];
$differences = [];
if (isset($_GET["debug"])) echo("Palette " . $id . ": " . implode(", ", array_map(function ($i) { return "#$i"; }, $importantColors)) . "\n");
foreach ($importantColors as $color) {
$r = hexdec(substr($color, 0, 2));
$g = hexdec(substr($color, 2, 2));
$b = hexdec(substr($color, 4, 2));
$dr = abs($r - $sr);
$dg = abs($g - $sg);
$db = abs($b - $sb);
$differences[] = $dr + $dg + $db;
}
$total = array_reduce($differences, function ($a, $b) { return $a + $b; }) / count($differences);
if (isset($_GET["debug"])) {
echo(" " . implode(", ", $differences) . "\n");
echo(" " . $total . "\n\n");
}
$differencesAll[] = [
"id" => $id,
"difference" => $total
];
}
usort($differencesAll, function ($a, $b) {
return $a["difference"] - $b["difference"];
});
if (isset($_GET["debug"])) {
echo("Smaller: " . $differencesAll[0]["id"] . ", " . $differencesAll[0]["difference"]);
}
$selectedPalette = $differencesAll[0]["id"];
if (isset($_GET["debug"])) {
echo("");
die();
}
}
global $userPalette;
$userPalette = $palettes["list"][$selectedPalette];
function rgb($color) {
return hexdec(substr($color, 0, 2)) . "," . hexdec(substr($color, 2, 2)) . "," . hexdec(substr($color, 4, 2));
}
function icon($name, $dark = null, $body = false) {
global $userPalette;
if (isset($dark)) {
return "/assets/icons/new/" . $name . ".svg?color=" . explode(",", $userPalette[$dark ? "dark" : "light"])[$body ? 6 : 9];
} else {
return "/assets/icons/new/" . $name . ".svg?color=" . explode(",", $userPalette[isset($_COOKIE["new2023UIDarkMode"]) && $_COOKIE["new2023UIDarkMode"] === "yes" ? "dark" : "light"])[$body ? 6 : 9];
}
}
foreach ([ "dark", "light" ] as $theme) { $palette = explode(",", $userPalette[$theme]); ?>