From 74849ad2d18586736d9677dfd10af4875f4ef2ca Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Wed, 14 Jan 2026 18:40:01 +0800 Subject: feat: enhance dark mode support across UI components - Updated BottomBar, HomeView, LoginModal, ModLoaderSelector, SettingsView, Sidebar, StatusToast, and VersionsView components for improved dark mode styling. - Adjusted color schemes for various elements to ensure better visibility and aesthetics in dark mode. - Added a theme property to settings to enforce dark mode as the default. - Refactored version badges in VersionsView for better color differentiation. - Enhanced button and input styles for consistency in both light and dark themes. --- ui/src/App.svelte | 39 +++++++++++++------ ui/src/components/BottomBar.svelte | 20 +++++----- ui/src/components/HomeView.svelte | 10 ++--- ui/src/components/LoginModal.svelte | 30 +++++++-------- ui/src/components/ModLoaderSelector.svelte | 40 ++++++++++---------- ui/src/components/SettingsView.svelte | 60 ++++++++++++++++++++---------- ui/src/components/Sidebar.svelte | 8 ++-- ui/src/components/StatusToast.svelte | 10 ++--- ui/src/components/VersionsView.svelte | 48 ++++++++++++------------ ui/src/stores/settings.svelte.ts | 6 +++ ui/src/types/index.ts | 1 + 11 files changed, 159 insertions(+), 113 deletions(-) (limited to 'ui/src') diff --git a/ui/src/App.svelte b/ui/src/App.svelte index d93374e..2160b85 100644 --- a/ui/src/App.svelte +++ b/ui/src/App.svelte @@ -31,12 +31,22 @@ onMount(async () => { authState.checkAccount(); - settingsState.loadSettings(); + await settingsState.loadSettings(); gameState.loadVersions(); getVersion().then((v) => (uiState.appVersion = v)); window.addEventListener("mousemove", handleMouseMove); }); + $effect(() => { + if (settingsState.settings.theme === 'light') { + document.documentElement.classList.remove('dark'); + document.documentElement.setAttribute('data-theme', 'light'); + } else { + document.documentElement.classList.add('dark'); + document.documentElement.setAttribute('data-theme', 'dark'); + } + }); + onDestroy(() => { if (typeof window !== 'undefined') window.removeEventListener("mousemove", handleMouseMove); @@ -44,10 +54,10 @@
-
+
{#if settingsState.settings.custom_background_path}
{:else if settingsState.settings.enable_visual_effects} - -
+ + {#if settingsState.settings.theme === 'dark'} +
+ {:else} + +
+ {/if} {#if uiState.currentView === "home"} {/if}
{/if} -
+
-
+
diff --git a/ui/src/components/BottomBar.svelte b/ui/src/components/BottomBar.svelte index dd218f3..0178111 100644 --- a/ui/src/components/BottomBar.svelte +++ b/ui/src/components/BottomBar.svelte @@ -5,7 +5,7 @@
@@ -17,7 +17,7 @@ onkeydown={(e) => e.key === "Enter" && authState.openLoginModal()} >
{#if authState.currentAccount}
-
+
{authState.currentAccount ? authState.currentAccount.username : "Login"}
-
+
{authState.currentAccount ? "Ready to play" : "Guest Mode"}
-
+
@@ -28,7 +28,7 @@
@@ -61,12 +61,12 @@ type="text" bind:value={authState.offlineUsername} placeholder="Offline Username" - class="w-full bg-zinc-950 border border-zinc-700 rounded p-3 text-white focus:border-indigo-500 outline-none" + class="w-full bg-gray-50 border-zinc-200 dark:bg-zinc-950 dark:border-zinc-700 rounded p-3 text-gray-900 dark:text-white focus:border-indigo-500 outline-none" onkeydown={(e) => e.key === "Enter" && authState.performOfflineLogin()} /> @@ -80,18 +80,18 @@
{:else if authState.deviceCodeData}
-

1. Go to this URL:

+

1. Go to this URL:

-

2. Enter this code:

+

2. Enter this code:

e.key === 'Enter' && navigator.clipboard.writeText(authState.deviceCodeData?.user_code || "")} @@ -106,8 +106,8 @@
-
- {authState.msLoginStatus} +
+ {authState.msLoginStatus}

This window will update automatically.

diff --git a/ui/src/components/ModLoaderSelector.svelte b/ui/src/components/ModLoaderSelector.svelte index 4a59916..fd26382 100644 --- a/ui/src/components/ModLoaderSelector.svelte +++ b/ui/src/components/ModLoaderSelector.svelte @@ -114,16 +114,16 @@
-

Select Mod Loader

+

Select Mod Loader

-
+
@@ -81,39 +81,39 @@ {/if}
-

+

Select an image from your computer to replace the default gradient background. Supported formats: PNG, JPG, WEBP, GIF.

-
+
-

Visual Effects

-

Enable particle effects and animated gradients. (Default: On)

+

Visual Effects

+

Enable particle effects and animated gradients. (Default: On)

{#if settingsState.settings.enable_visual_effects} -
+
-

Theme Effect

-

Select the active visual theme.

+

Theme Effect

+

Select the active visual theme.

-
+
{#each ['all', 'release', 'snapshot', 'modded'] as filter}