diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index fcfe247..2bd3fe1 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -11,6 +11,7 @@ import StoryMode from "./pages/StoryMode.svelte"; import Welcome from "./pages/Welcome.svelte"; import { parseJSON } from "./index"; import arenaImages from "./arena-images"; +import { currentTheme, THEMES } from "./settings"; const backgroundImage = arenaImages[Math.floor(Math.random() * arenaImages.length)]; @@ -33,6 +34,15 @@ let eventsVisible = $state(false); let showGuiSettings = $state(false); +let mainClassString = $derived( + ( + THEMES[$currentTheme] ?? + (window.matchMedia("(prefers-color-scheme: dark)").matches + ? THEMES["Dark blurred"] + : THEMES["Light"]) + ).join(" "), +); + let paths: { tagName: string | null; repo: string | null; @@ -44,8 +54,11 @@ let paths: { -
-
+
+
@@ -105,7 +118,10 @@ let paths: { >GUI Settings
@@ -158,14 +174,17 @@ let paths: { height: 3rem; justify-content: space-between; padding: 0.1rem; - /* Nice transparent blur */ - background-color: rgba(0, 0, 0, 0.6); - -webkit-backdrop-filter: blur(10px); - backdrop-filter: blur(10px); - /* background: var(--background-alt); - color: var(--foreground-alt); */ + background: var(--background); + color: var(--foreground); transition: translate 0.2s ease-in-out; } + + .navbar:has(.dropdown:focus-within) { + /* We cannot set z-index in the child because it is implicitly set to + 0 here unless specified due to the backdrop-filter (i think?) */ + z-index: 1; + } + .navbar.offset { translate: 0 -100%; } @@ -234,7 +253,7 @@ let paths: { border-radius: 0.2rem; } #events img { - filter: invert() brightness(90%); + filter: invert() brightness(var(--icon-brightness)); width: 20px; vertical-align: middle; margin-bottom: 4px; diff --git a/frontend/src/components/BotList.svelte b/frontend/src/components/BotList.svelte index e6020b6..1b8dcf4 100644 --- a/frontend/src/components/BotList.svelte +++ b/frontend/src/components/BotList.svelte @@ -4,7 +4,7 @@ import { Browser } from "@wailsio/runtime"; import SuperJSON from "superjson"; import toast from "svelte-5-french-toast"; import { flip } from "svelte/animate"; -import { App, BotInfo } from "../../bindings/gui"; +import { App, BotInfo, HumanInfo, PsyonixBotInfo } from "../../bindings/gui"; import infoIcon from "../assets/info_icon.svg"; import defaultIcon from "../assets/rlbot_mono.png"; import starIcon from "../assets/star.svg"; @@ -110,11 +110,6 @@ $effect(() => { }); let selectedAgent: [BotInfo, string, string] | null = $state(null); -$effect(() => { - if (!showInfoModal && !showLoadoutEditor) { - selectedAgent = null; - } -}); const filteredBots: DraggablePlayer[] = $derived.by(() => filterBots(bots, selectedTags, showHuman, searchQuery), @@ -315,7 +310,7 @@ function SelectedToggleFavorite() { {#each filteredBots as bot (bot.id)}
handleBotClick(bot)} > - icon + icon

{bot.displayName}

{#if bot.uniquePathSegment} ({bot.uniquePathSegment}) @@ -353,14 +355,21 @@ function SelectedToggleFavorite() { {#each filteredScripts as script (script.id)} -
toggleScript(script.id)}> +
toggleScript(script.id)}> toggleScript(script.id)} /> - icon + icon

{script.displayName}

{#if script.uniquePathSegment} ({script.uniquePathSegment}) @@ -426,7 +435,7 @@ function SelectedToggleFavorite() { {#if selectedAgent[2]} {/if} @@ -485,7 +494,7 @@ function SelectedToggleFavorite() { padding: 0.5rem 1rem; border-radius: 0; cursor: pointer; - background-color: var(--background-alt); + /*background-color: var(--background-alt);*/ } .tag-buttons button:first-child { border-radius: var(--border-radius) 0 0 var(--border-radius); @@ -536,7 +545,7 @@ function SelectedToggleFavorite() { font-size: 1rem; } .info-button img { - filter: invert() brightness(90%); + filter: invert() brightness(var(--icon-brightness)); height: 100%; width: auto; } diff --git a/frontend/src/components/BotpackToast.svelte b/frontend/src/components/BotpackToast.svelte index e78be1b..5f57e80 100644 --- a/frontend/src/components/BotpackToast.svelte +++ b/frontend/src/components/BotpackToast.svelte @@ -15,7 +15,7 @@ let { diff --git a/frontend/src/settings.ts b/frontend/src/settings.ts index 6100f5d..520acd4 100644 --- a/frontend/src/settings.ts +++ b/frontend/src/settings.ts @@ -1,6 +1,22 @@ import { writable } from "svelte/store"; import { MAPS_STANDARD } from "./arena-names"; +export const THEMES = { + "Light blurred": ["lightTheme", "blur"], + "Light": ["lightTheme"], + "Dark blurred": ["darkTheme", "blur"], + "Dark": ["darkTheme"], + "Follow system": null +} as const; + +export const currentTheme = writable( + localStorage.getItem("APP_THEME") as keyof typeof THEMES || "Follow system" +) +currentTheme.subscribe((value)=>{ + console.log("Theme is now", value) + localStorage.setItem("APP_THEME", value); +}) + export const mapStore = writable( localStorage.getItem("MS_MAP") || MAPS_STANDARD["DFH Stadium"], );