Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(theme): force dark from first paint, drop onboarding theme picker (Bug h)

purplef6cb4fc3bca9
diff --git a/index.html b/index.html
index 26c5113a..cd21db19 100644
--- a/index.html
+++ b/index.html
@@ -1,12 +1,22 @@
<!doctype html>
-<html lang="en">
+<!--
+ Bug (h): paint dark from the very first frame. The previous default
+ (no class on <html>) gave Tailwind nothing to match against until
+ AppShell's useEffect ran one render later — that's the "weiß flash"
+ you'd see between window-show and the first React commit, and the
+ reason the app could even render fully white if the user happened to
+ pick Light in the (now-removed) onboarding theme step. Hard-code dark
+ here; AppShell still toggles `light` on top if the user opts into it
+ via Settings → General → Appearance.
+-->
+<html lang="en" class="dark" style="background:#0a0a0a">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Locally Uncensored</title>
</head>
- <body>
+ <body style="background:#0a0a0a;margin:0">
<div id="root"><div id="splash" style="position:fixed;inset:0;background:#0a0a0a;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:9999"><img src="/LU-monogram-bw.png" width="80" height="80" alt="" style="margin-bottom:20px;opacity:0.9" /><div style="color:#444;font-size:12px;font-family:system-ui,sans-serif;letter-spacing:0.1em;text-transform:uppercase">Loading</div></div></div>
<script type="module" src="/src/main.tsx"></script>
</body>
diff --git a/src/components/layout/AppShell.tsx b/src/components/layout/AppShell.tsx
index dc4fb6ec..5f8206fe 100644
--- a/src/components/layout/AppShell.tsx
+++ b/src/components/layout/AppShell.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from 'react'
+import { useEffect, useLayoutEffect, useState } from 'react'
import { Header } from './Header'
import { StaleModelsBanner } from './StaleModelsBanner'
import { Sidebar } from './Sidebar'
@@ -167,9 +167,17 @@ export function AppShell() {
}
}, [])
- useEffect(() => {
- document.documentElement.classList.toggle('dark', settings.theme === 'dark')
- document.documentElement.classList.toggle('light', settings.theme === 'light')
+ // Bug (h): synchronously sync the theme class with the persisted setting
+ // BEFORE first paint, so the user never sees a one-frame white flash on
+ // launch. useLayoutEffect runs before the browser commits the paint;
+ // useEffect (the previous code) ran after, which produced the
+ // "build sometimes opens white" symptom. Default-`dark` is also baked
+ // into index.html so the very first paint (before any React renders)
+ // is already dark even on cold-start.
+ useLayoutEffect(() => {
+ const isDark = settings.theme !== 'light' // unset / undefined → dark
+ document.documentElement.classList.toggle('dark', isDark)
+ document.documentElement.classList.toggle('light', !isDark)
}, [settings.theme])
// ── Issue #31: Ollama host sync (Rust ↔ frontend) ─────────────
diff --git a/src/components/onboarding/Onboarding.tsx b/src/components/onboarding/Onboarding.tsx
index 85899730..f1daf546 100644
--- a/src/components/onboarding/Onboarding.tsx
+++ b/src/components/onboarding/Onboarding.tsx
@@ -16,8 +16,13 @@ import { getSystemVRAM } from '../../api/comfyui'
import { pullModelTauri, checkConnection as checkOllama } from '../../api/ollama'
import { hfUrlToOllamaRef, hfUrlToLmStudioSubdir } from '../../lib/hf-to-provider'
-type Step = 'welcome' | 'theme' | 'backends' | 'comfyui' | 'models' | 'done'
-const STEP_ORDER: Step[] = ['welcome', 'theme', 'backends', 'comfyui', 'models', 'done']
+// Bug (h): the dedicated 'theme' onboarding step was removed because users
+// kept ending up on Light by accident, and the project standard is "dark
+// always". Light mode stays available in Settings → General → Appearance
+// for users who explicitly want it; we just don't push them through the
+// choice on first launch anymore.
+type Step = 'welcome' | 'backends' | 'comfyui' | 'models' | 'done'
+const STEP_ORDER: Step[] = ['welcome', 'backends', 'comfyui', 'models', 'done']
const isTauri = typeof window !== 'undefined' && !!(window as any).__TAURI_INTERNALS__
/* ── Local backend info for the "nothing found" state ──────── */
@@ -494,43 +499,6 @@ export function Onboarding() {
<p className={`text-[0.75rem] leading-relaxed ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>
Private, local AI chat. No servers, no tracking, everything stays on your machine.
</p>
- <button onClick={() => setStep('theme')} className={primaryBtn}>
- Get Started <ArrowRight size={14} />
- </button>
- </motion.div>
- )}
-
- {/* Step 2: Theme */}
- {step === 'theme' && (
- <motion.div
- key="theme"
- className="max-w-sm w-full text-center space-y-4"
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- exit={{ opacity: 0, y: -20 }}
- >
- <h2 className="text-base font-semibold">Choose your theme</h2>
- <p className={`text-[0.7rem] ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>You can change this later in settings.</p>
- <div className="flex gap-3 justify-center">
- <button
- onClick={() => updateSettings({ theme: 'light' })}
- className={`flex flex-col items-center gap-2 p-4 rounded-lg border transition-all w-28 ${
- !isDark ? 'border-gray-900 bg-gray-50' : 'border-white/10 hover:border-white/20'
- }`}
- >
- <div className="w-4 h-4 rounded-full bg-white border border-gray-300" />
- <span className="text-[0.7rem] font-medium">Light</span>
- </button>
- <button
- onClick={() => updateSettings({ theme: 'dark' })}
- className={`flex flex-col items-center gap-2 p-4 rounded-lg border transition-all w-28 ${
- isDark ? 'border-white bg-white/10' : 'border-gray-200 hover:border-gray-400'
- }`}
- >
- <div className="w-4 h-4 rounded-full bg-[#050505]" />
- <span className="text-[0.7rem] font-medium">Dark</span>
- </button>
- </div>
<button
onClick={() => {
setStep('backends')
@@ -538,11 +506,15 @@ export function Onboarding() {
}}
className={primaryBtn}
>
- Next <ArrowRight size={14} />
+ Get Started <ArrowRight size={14} />
</button>
</motion.div>
)}
+ {/* Step 2 (theme picker) was removed in Bug (h). Light mode is
+ still available in Settings → General → Appearance for users
+ who want it explicitly. */}
+
{/* Step 3: Backend Detection */}
{step === 'backends' && (
<motion.div