From 46251292b5c8b431de66aeff473594ccec60e04c Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Thu, 20 Jul 2023 18:29:09 +0200 Subject: Updated 19 files and added 26 files (automated) --- includes/components/header.inc | 464 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 456 insertions(+), 8 deletions(-) (limited to 'includes/components/header.inc') diff --git a/includes/components/header.inc b/includes/components/header.inc index 5179d54..0fa60ae 100644 --- a/includes/components/header.inc +++ b/includes/components/header.inc @@ -1,6 +1,12 @@ - - - + + .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);">
- + @@ -230,6 +239,367 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; + "); + + echo("Color difference debug\n======================\n\n"); + echo("Member 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]); ?> + + + + + + + + + + + + + + + +
\ No newline at end of file -- cgit