">
Error ' . $errno . ': ' . $errstr . ' [' . $file . ':' . $line . ']
'); } } if (isset($_GET['errors'])) { ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); set_error_handler("error", E_ALL); } global $_MemberName; global $_MemberPage; global $_SystemName; global $_SystemPage; global $toplevel; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $page = $pages[$toplevel] ?? [ "rail" => 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/pronouns.inc"; require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/bitset.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/banner.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; ?> .css" rel="preload" as="style"> .css" rel="preload" as="style"> .css" rel="stylesheet"> <?= $title && $title !== "-" ? $title . " ยท " : "" ?>Cold Haze .png" type="image/png"> .css" rel="stylesheet"> style="background-color: #000;" style="background-color: var(--palette-1);">
"); echo("Color difference debug\n======================\n\n"); echo("Color: #" . $member["color"] . "\n\n"); } $sr = hexdec(substr($member["color"], 0, 2)); $sg = hexdec(substr($member["color"], 2, 2)); $sb = hexdec(substr($member["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]); ?>