11import windowState from "electron-window-state"
2+ import { resolveThemeVariant } from "@opencode-ai/ui/theme/resolve"
23import { app , BrowserWindow , net , nativeImage , nativeTheme , protocol } from "electron"
34import { dirname , isAbsolute , join , relative , resolve } from "node:path"
45import { fileURLToPath , pathToFileURL } from "node:url"
56import type { TitlebarTheme } from "../preload/types"
7+ import type { DesktopTheme } from "@opencode-ai/ui/theme/types"
8+ import oc2ThemeJson from "../../../ui/src/theme/themes/oc-2.json"
69
710const root = dirname ( fileURLToPath ( import . meta. url ) )
811const rendererRoot = join ( root , "../renderer" )
@@ -11,6 +14,11 @@ const rendererHost = "renderer"
1114const clipboardWritePermission = "clipboard-sanitized-write"
1215const notificationPermission = "notifications"
1316const rendererPermissions = new Set ( [ clipboardWritePermission , notificationPermission ] )
17+ const oc2Theme = oc2ThemeJson as DesktopTheme
18+ const oc2Background = {
19+ light : resolveThemeVariant ( oc2Theme . light , false ) [ "background-base" ] ,
20+ dark : resolveThemeVariant ( oc2Theme . dark , true ) [ "background-base" ] ,
21+ }
1422
1523protocol . registerSchemesAsPrivileged ( [
1624 {
@@ -50,8 +58,7 @@ function tone() {
5058}
5159
5260function defaultBackgroundColor ( ) {
53- // Match OC-2 --background-base so native paints before the renderer theme loads do not flash white.
54- return tone ( ) === "dark" ? "#101010" : "#f8f8f8"
61+ return oc2Background [ tone ( ) ]
5562}
5663
5764function overlay ( theme : Partial < TitlebarTheme > = { } , zoom = 1 ) {
0 commit comments