Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(theme): allow background image to show in dark mode and IDE themes

lxk955024dc757a875
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue
index 05a3c8840d..eacf0e6d92 100644
--- a/apps/desktop/src/App.vue
+++ b/apps/desktop/src/App.vue
@@ -4375,7 +4375,7 @@ onUnmounted(() => {
<div class="h-full w-full" :style="appBackgroundImageStyle"></div>
</div>
<TooltipProvider :delay-duration="300">
- <div class="h-screen w-screen max-w-full min-w-[760px] min-h-[600px] flex flex-col bg-background text-foreground overflow-hidden" :class="{ 'dbx-desktop-window-frame': drawDesktopWindowFrame }" :style="appUiFontFamilyStyle">
+ <div data-app-shell class="h-screen w-screen max-w-full min-w-[760px] min-h-[600px] flex flex-col bg-background text-foreground overflow-hidden" :class="{ 'dbx-desktop-window-frame': drawDesktopWindowFrame }" :style="appUiFontFamilyStyle">
<AppToolbar
v-if="!isDetachedWindowContext"
:is-dark="isDark"
diff --git a/apps/desktop/src/components/layout/WelcomeScreen.vue b/apps/desktop/src/components/layout/WelcomeScreen.vue
index f170810a63..e3221e40e2 100644
--- a/apps/desktop/src/components/layout/WelcomeScreen.vue
+++ b/apps/desktop/src/components/layout/WelcomeScreen.vue
@@ -47,7 +47,7 @@ function welcomeConnectionSubtitle(connection: ConnectionConfig): string {
</script>
<template>
- <div class="min-w-0 flex-1 overflow-x-hidden overflow-y-auto bg-background">
+ <div data-welcome-screen class="min-w-0 flex-1 overflow-x-hidden overflow-y-auto bg-background">
<div v-if="welcomePageMode !== 'workspace'" class="welcome-intro mx-auto flex min-h-full w-full min-w-0 max-w-5xl flex-col justify-center px-6 py-10 sm:px-8">
<div class="welcome-intro-hero relative overflow-hidden rounded-2xl border px-6 py-10 sm:px-10 sm:py-14">
<div class="welcome-intro-glow pointer-events-none absolute -right-24 -top-24 h-64 w-64 rounded-full bg-primary/15 blur-3xl" />
diff --git a/apps/desktop/src/composables/__tests__/useBackgroundImageLifecycle.spec.ts b/apps/desktop/src/composables/__tests__/useBackgroundImageLifecycle.spec.ts
index a042be59a2..b2a9679d0a 100644
--- a/apps/desktop/src/composables/__tests__/useBackgroundImageLifecycle.spec.ts
+++ b/apps/desktop/src/composables/__tests__/useBackgroundImageLifecycle.spec.ts
@@ -429,4 +429,18 @@ describe("background image theme and scope lifecycle", () => {
expect(createObjectURL).toHaveBeenCalledTimes(1);
expect(revokeObjectURL).not.toHaveBeenCalled();
});
+
+ it("clears body, #root, outer app shell, welcome screen and CodeMirror scroller in globals.css", async () => {
+ const fs = await import("node:fs");
+ const path = await import("node:path");
+ const globalsCss = fs.readFileSync(path.resolve(__dirname, "../../styles/globals.css"), "utf8");
+ expect(globalsCss).toContain("html.dbx-bg-active,");
+ expect(globalsCss).toContain("html.dbx-bg-active body,");
+ expect(globalsCss).toContain("html.dbx-bg-active #root,");
+ expect(globalsCss).toContain("html.dbx-bg-active [data-app-shell],");
+ expect(globalsCss).toContain("html.dbx-bg-active [data-welcome-screen],");
+ expect(globalsCss).toContain("html.dbx-bg-active .cm-editor,");
+ expect(globalsCss).toContain("html.dbx-bg-active .cm-gutters,");
+ expect(globalsCss).toContain("html.dbx-bg-active .cm-scroller");
+ });
});
diff --git a/apps/desktop/src/lib/__tests__/editorThemes.spec.ts b/apps/desktop/src/lib/__tests__/editorThemes.spec.ts
index c826862302..3475dabd3a 100644
--- a/apps/desktop/src/lib/__tests__/editorThemes.spec.ts
+++ b/apps/desktop/src/lib/__tests__/editorThemes.spec.ts
@@ -194,6 +194,18 @@ describe("Cursor editor theme selection", () => {
expect(wcagContrastRatio(dark.foreground, dark.selection), `cursor-dark text on selection`).toBeGreaterThanOrEqual(3.0);
expect(wcagContrastRatio(light.foreground, light.selection), `cursor-light text on selection`).toBeGreaterThanOrEqual(3.0);
});
+
+ it("does not paint an opaque background on .cm-scroller so background images can show through", async () => {
+ const ideThemes = ["idea-dark", "idea-light", "jetbrains-dark", "jetbrains-light", "cursor-dark", "cursor-light", "claude-dark", "claude-light"] as const;
+
+ for (const theme of ideThemes) {
+ const extension = (await loadEditorTheme(theme, "dark")) as any;
+ const themeFacet = extension[0]?.find((ext: any) => ext?.value?.rules);
+ expect(themeFacet).toBeDefined();
+ const scrollerRule = themeFacet.value.rules.find((r: string) => r.includes(".cm-scroller {") && r.includes("background"));
+ expect(scrollerRule, `${theme} should not set an opaque background on .cm-scroller`).toBeUndefined();
+ }
+ });
});
describe("SQL completion theme", () => {
diff --git a/apps/desktop/src/lib/editor/editorThemes.ts b/apps/desktop/src/lib/editor/editorThemes.ts
index 3fe24ff518..51b7ba7eee 100644
--- a/apps/desktop/src/lib/editor/editorThemes.ts
+++ b/apps/desktop/src/lib/editor/editorThemes.ts
@@ -535,9 +535,6 @@ function createIdeEditorTheme(EditorView: typeof import("@codemirror/view").Edit
[EDITOR_SELECTION_BACKGROUND_CSS_VAR]: c.selection,
[SQL_TABLE_COLOR_CSS_VAR]: c.table,
},
- ".cm-scroller": {
- backgroundColor: c.background,
- },
".cm-content": {
caretColor: c.cursor,
},
diff --git a/apps/desktop/src/styles/globals.css b/apps/desktop/src/styles/globals.css
index 4cf968792d..b91c8a70a9 100644
--- a/apps/desktop/src/styles/globals.css
+++ b/apps/desktop/src/styles/globals.css
@@ -3067,8 +3067,17 @@ body.dbx-is-resizing .panel-resize-handle::before {
CodeMirror themes paint opaque editor backgrounds via EditorView.theme, so
clear them app-wide to let the background image show through. Active line,
selection, and search-highlight layers keep their own translucent colors
- and stay readable on top. */
+ and stay readable on top.
+ Also clear outer body/root/shell wrappers and scrollers so translucent
+ surfaces don't compound opacity over the wallpaper layer. */
+html.dbx-bg-active,
+html.dbx-bg-active body,
+html.dbx-bg-active #root,
+html.dbx-bg-active [data-app-shell],
+html.dbx-bg-active [data-welcome-screen],
html.dbx-bg-active .cm-editor,
-html.dbx-bg-active .cm-gutters {
+html.dbx-bg-active .cm-gutters,
+html.dbx-bg-active .cm-scroller {
background-color: transparent !important;
}
+