fix(desktop): restore legacy webview tints and active tab background
This commit is contained in:
11 files changed
+364
-16
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { useConnectionStore } from "@/stores/connectionStore";
|
||||
import { useSettingsStore } from "@/stores/settingsStore";
|
||||
import { hexToRgba } from "@/lib/common/color";
|
||||
import { isLegacyWebView } from "@/lib/ui/legacyWebView";
|
||||
import type { CSSProperties } from "vue";
|
||||
import { findConnectionGroupPath } from "@/lib/sidebar/sidebarLayout";
|
||||
import { supportsConnectionDatabaseInfo } from "@/lib/connection/connectionDatabaseInfo";
|
||||
@@ -682,14 +683,38 @@ export function tabIconClass(tab: QueryTab): string {
|
||||
return "text-blue-600 dark:text-blue-400";
|
||||
}
|
||||
|
||||
// WebKit without color-mix() (macOS 12 Safari < 16.2) invalidates these inline
|
||||
// values at computed-value time, leaving the active tab with no background at
|
||||
// all — and it also fails to substitute var() references inside inline custom
|
||||
// properties, so the legacy branch resolves the theme token to concrete rgb
|
||||
// once per call instead of leaning on rgba(var(--dbx-foreground-rgb), …).
|
||||
function foregroundRgb(): string {
|
||||
if (typeof document !== "undefined") {
|
||||
const rgb = getComputedStyle(document.documentElement).getPropertyValue("--dbx-foreground-rgb").trim();
|
||||
if (rgb) return rgb;
|
||||
}
|
||||
return "10, 10, 10";
|
||||
}
|
||||
|
||||
export function appTabActiveBackground(): string {
|
||||
if (isLegacyWebView()) return `rgba(${foregroundRgb()}, 0.18)`;
|
||||
return "color-mix(in srgb, var(--foreground) 18%, var(--background))";
|
||||
}
|
||||
|
||||
export function appTabActiveIndicator(): string {
|
||||
if (isLegacyWebView()) return `inset 0 -2px 0 rgba(${foregroundRgb()}, 0.72)`;
|
||||
return "inset 0 -2px 0 color-mix(in srgb, var(--foreground) 72%, transparent)";
|
||||
}
|
||||
|
||||
export function tabColorStyle(tab: QueryTab, active: boolean, isClassic: boolean): CSSProperties | undefined {
|
||||
const activeIndicator = "inset 0 -2px 0 color-mix(in srgb, var(--foreground) 72%, transparent)";
|
||||
const activeIndicator = appTabActiveIndicator();
|
||||
const color = connectionColor(tab.connectionId);
|
||||
if (!color) {
|
||||
const background = appTabActiveBackground();
|
||||
if (isClassic) {
|
||||
return active ? { "--app-tab-background": "color-mix(in srgb, var(--foreground) 18%, var(--background))", boxShadow: activeIndicator } : undefined;
|
||||
return active ? { "--app-tab-background": background, boxShadow: activeIndicator } : undefined;
|
||||
}
|
||||
return active ? { "--app-tab-background": "color-mix(in srgb, var(--foreground) 18%, var(--background))", borderColor: "var(--ring)" } : undefined;
|
||||
return active ? { "--app-tab-background": background, borderColor: "var(--ring)" } : undefined;
|
||||
}
|
||||
if (isClassic) {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user