fix(frontend,macos): reduce dark mode white flash on window open
Detect dark/light mode before React hydrates to eliminate the visible white-to-dark flash when opening windows in dark mode. Frontend: - Inline script now reads next-themes localStorage key and applies .dark class, colorScheme, and backgroundColor on <html> before first paint - Add CSS-only fallback via prefers-color-scheme media query in an inline <style> tag that fires before any JS executes macOS backend: - Detect system dark mode via `defaults read -g AppleInterfaceStyle` (cached with OnceLock) and set native window background color to match dark theme in apply_platform_window_style - Persist user appearance mode preference (dark/light/system) to DB alongside zoom level so new windows use the correct background - Add update_appearance_mode Tauri command; frontend syncs on mount, on settings change, and on cross-window storage events Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -83,9 +83,9 @@ mod tauri_app {
|
||||
}
|
||||
}
|
||||
|
||||
// Load saved zoom level for traffic-light positioning before
|
||||
// any window is created.
|
||||
// Load saved appearance settings before any window is created.
|
||||
tauri::async_runtime::block_on(windows::load_saved_zoom(&db.conn));
|
||||
tauri::async_runtime::block_on(windows::load_saved_appearance_mode(&db.conn));
|
||||
|
||||
// Install bundled expert skills into the central store
|
||||
// (`~/.codeg/skills/`). Runs in the background and does
|
||||
@@ -341,6 +341,7 @@ mod tauri_app {
|
||||
windows::open_push_window,
|
||||
windows::open_project_boot_window,
|
||||
windows::update_traffic_light_position,
|
||||
windows::update_appearance_mode,
|
||||
project_boot::detect_package_manager,
|
||||
project_boot::create_shadcn_project,
|
||||
system_settings::get_system_proxy_settings,
|
||||
|
||||
Reference in New Issue
Block a user