fix(theme): allow background image to show in dark mode and IDE themes
This commit is contained in:
1 parent
7bb0431470
commit
024dc757a8
6 files changed
+39
-7
No files matched your search
@@ -4375,7 +4375,7 @@ onUnmounted(() => {
|
|||||||
<div class="h-full w-full" :style="appBackgroundImageStyle"></div>
|
<div class="h-full w-full" :style="appBackgroundImageStyle"></div>
|
||||||
</div>
|
</div>
|
||||||
<TooltipProvider :delay-duration="300">
|
<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
|
<AppToolbar
|
||||||
v-if="!isDetachedWindowContext"
|
v-if="!isDetachedWindowContext"
|
||||||
:is-dark="isDark"
|
:is-dark="isDark"
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function welcomeConnectionSubtitle(connection: ConnectionConfig): string {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<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 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-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" />
|
<div class="welcome-intro-glow pointer-events-none absolute -right-24 -top-24 h-64 w-64 rounded-full bg-primary/15 blur-3xl" />
|
||||||
|
|||||||
@@ -429,4 +429,18 @@ describe("background image theme and scope lifecycle", () => {
|
|||||||
expect(createObjectURL).toHaveBeenCalledTimes(1);
|
expect(createObjectURL).toHaveBeenCalledTimes(1);
|
||||||
expect(revokeObjectURL).not.toHaveBeenCalled();
|
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");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -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(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);
|
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", () => {
|
describe("SQL completion theme", () => {
|
||||||
|
|||||||
@@ -535,9 +535,6 @@ function createIdeEditorTheme(EditorView: typeof import("@codemirror/view").Edit
|
|||||||
[EDITOR_SELECTION_BACKGROUND_CSS_VAR]: c.selection,
|
[EDITOR_SELECTION_BACKGROUND_CSS_VAR]: c.selection,
|
||||||
[SQL_TABLE_COLOR_CSS_VAR]: c.table,
|
[SQL_TABLE_COLOR_CSS_VAR]: c.table,
|
||||||
},
|
},
|
||||||
".cm-scroller": {
|
|
||||||
backgroundColor: c.background,
|
|
||||||
},
|
|
||||||
".cm-content": {
|
".cm-content": {
|
||||||
caretColor: c.cursor,
|
caretColor: c.cursor,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3067,8 +3067,17 @@ body.dbx-is-resizing .panel-resize-handle::before {
|
|||||||
CodeMirror themes paint opaque editor backgrounds via EditorView.theme, so
|
CodeMirror themes paint opaque editor backgrounds via EditorView.theme, so
|
||||||
clear them app-wide to let the background image show through. Active line,
|
clear them app-wide to let the background image show through. Active line,
|
||||||
selection, and search-highlight layers keep their own translucent colors
|
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-editor,
|
||||||
html.dbx-bg-active .cm-gutters {
|
html.dbx-bg-active .cm-gutters,
|
||||||
|
html.dbx-bg-active .cm-scroller {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user