From 30992fbf48839fce3d06b348cd800101218dcd68 Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Wed, 29 Oct 2025 00:44:51 +0000 Subject: [PATCH] fix: align new-session styling and improve dark theme startup --- electron/main/main.ts | 6 ++- src/components/instance-welcome-view.tsx | 69 +++++++++++------------- src/components/session-picker.tsx | 31 ++++++++++- src/renderer/index.html | 31 +++++++++++ src/styles/components.css | 52 +++++++++++++++--- src/styles/tokens.css | 64 +++++++++++++++++++++- 6 files changed, 205 insertions(+), 48 deletions(-) diff --git a/electron/main/main.ts b/electron/main/main.ts index 775c757f..fb1b691d 100644 --- a/electron/main/main.ts +++ b/electron/main/main.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, dialog, ipcMain } from "electron" +import { app, BrowserWindow, dialog, ipcMain, nativeTheme } from "electron" import { join } from "path" import { createApplicationMenu } from "./menu" import { setupInstanceIPC } from "./ipc" @@ -10,11 +10,15 @@ setupStorageIPC() let mainWindow: BrowserWindow | null = null function createWindow() { + const prefersDark = nativeTheme.shouldUseDarkColors + const backgroundColor = prefersDark ? "#1a1a1a" : "#ffffff" + mainWindow = new BrowserWindow({ width: 1400, height: 900, minWidth: 800, minHeight: 600, + backgroundColor, webPreferences: { preload: join(__dirname, "../preload/index.js"), contextIsolation: true, diff --git a/src/components/instance-welcome-view.tsx b/src/components/instance-welcome-view.tsx index ba662060..aef71edd 100644 --- a/src/components/instance-welcome-view.tsx +++ b/src/components/instance-welcome-view.tsx @@ -231,11 +231,8 @@ const InstanceWelcomeView: Component = (props) => {

Create a fresh conversation with your chosen agent

- 0} - fallback={
Loading agents...
} - > -
+
+ 0}>
+
-
- } - > -
- - - - Create Session -
- Cmd+Enter - - -
-
+ +
diff --git a/src/components/session-picker.tsx b/src/components/session-picker.tsx index 84dfcb57..bf627980 100644 --- a/src/components/session-picker.tsx +++ b/src/components/session-picker.tsx @@ -129,11 +129,38 @@ const SessionPicker: Component = (props) => { diff --git a/src/renderer/index.html b/src/renderer/index.html index 6b17ca75..d017b60c 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -4,6 +4,37 @@ OpenCode Client + +
diff --git a/src/styles/components.css b/src/styles/components.css index beaf8bcf..5bea0156 100644 --- a/src/styles/components.css +++ b/src/styles/components.css @@ -76,6 +76,22 @@ @apply cursor-not-allowed opacity-50; } +/* Ensure Tailwind base reset on [type="button"] doesn't remove accent styles */ +button.button-primary { + background-color: var(--accent-primary); + color: var(--text-inverted); +} + +[data-theme="dark"] button.button-primary { + background-color: #3f3f46; + color: #f5f6f8; +} + +[data-theme="dark"] button.button-primary:hover:not(:disabled) { + background-color: #52525b; + opacity: 1; +} + .button-secondary { @apply inline-flex items-center justify-center gap-2 rounded-lg px-6 py-3 text-base font-medium transition-colors; background-color: var(--surface-secondary); @@ -378,12 +394,23 @@ background-color: var(--surface-hover); } +[data-theme="dark"] .tab-active { + background-color: #3f3f46; + color: #f5f6f8; +} + +[data-theme="dark"] .tab-active:hover { + background-color: #52525b; +} + [data-theme="dark"] .tab-inactive { - background-color: var(--surface-muted); + background-color: #2a2a31; + color: #d4d4d8; } [data-theme="dark"] .tab-inactive:hover { - background-color: var(--surface-hover); + background-color: #3f3f46; + color: #f5f6f8; } .tab-label { @@ -410,6 +437,15 @@ background-color: var(--surface-hover); } +[data-theme="dark"] .new-tab-button { + background-color: #3f3f46; + color: #f5f6f8; +} + +[data-theme="dark"] .new-tab-button:hover { + background-color: #52525b; +} + .new-tab-button:focus-visible { @apply ring-2 ring-offset-1; ring-color: var(--accent-primary); @@ -1201,12 +1237,16 @@ } .selector-button { - @apply px-3 py-1.5 text-sm rounded transition-colors cursor-pointer; + @apply px-3 py-1.5 text-sm rounded transition-colors cursor-pointer w-full inline-flex items-center justify-center font-medium; + background-color: var(--surface-secondary); + color: var(--text-primary); + border: 1px solid var(--border-base); } .selector-button-primary { - background-color: var(--accent-primary); - color: var(--text-inverted); + background-color: var(--accent-primary) !important; + color: var(--text-inverted) !important; + border: 1px solid var(--accent-primary) !important; } .selector-button-primary:hover:not(:disabled) { @@ -1374,7 +1414,7 @@ } .panel-section-header { - @apply w-full px-4 py-3 flex items-center justify-between transition-colors cursor-pointer; + @apply w-full px-4 py-3 flex items-center justify-center transition-colors cursor-pointer gap-2; background-color: var(--surface-secondary); } diff --git a/src/styles/tokens.css b/src/styles/tokens.css index a96546b9..5dd8465f 100644 --- a/src/styles/tokens.css +++ b/src/styles/tokens.css @@ -58,6 +58,68 @@ --line-height-relaxed: 1.6; } +@media (prefers-color-scheme: dark) { + :root { + /* Surface tokens */ + --surface-base: #1a1a1a; + --surface-secondary: #2a2a2a; + --surface-muted: #212529; + --surface-code: #1a1a1a; + --surface-hover: #3a3a3a; + + /* Border tokens */ + --border-base: #3a3a3a; + --border-secondary: #3a3a3a; + --border-muted: #3a3a3a; + + /* Text tokens */ + --text-primary: #e0e0e0; + --text-secondary: #999999; + --text-muted: #999999; + --text-inverted: #1a1a1a; + + /* Accent tokens */ + --accent-primary: #0080ff; + --accent-hover: #0066cc; + + /* Status tokens */ + --status-success: #4caf50; + --status-error: #f44336; + --status-warning: #ff9800; + + /* Message-specific tokens */ + --message-user-bg: #1a2332; + --message-user-border: #42a5f5; + --message-assistant-bg: #251a2e; + --message-assistant-border: #ba68c8; + --message-tool-bg: #212529; + --message-tool-border: #adb5bd; + + /* Typography tokens (same as light theme) */ + --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + --font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; + + /* Font weights */ + --font-weight-regular: 400; + --font-weight-medium: 500; + --font-weight-semibold: 600; + --font-weight-bold: 700; + + /* Font sizes */ + --font-size-xs: 11px; + --font-size-sm: 12px; + --font-size-base: 14px; + --font-size-lg: 16px; + --font-size-xl: 18px; + --font-size-2xl: 20px; + + /* Line heights */ + --line-height-tight: 1.25; + --line-height-normal: 1.5; + --line-height-relaxed: 1.6; + } +} + [data-theme="dark"] { /* Surface tokens */ --surface-base: #1a1a1a; @@ -116,4 +178,4 @@ --line-height-tight: 1.25; --line-height-normal: 1.5; --line-height-relaxed: 1.6; -} \ No newline at end of file +}