From 3718b860443e32b8656c5ee275b3b31b11a1f511 Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Sun, 4 May 2025 13:19:56 +0800 Subject: [PATCH] refactor(WindowService, ThemeProvider): streamline title bar style and theme toggling logic (#5633) * fix(config): update title bar overlay colors for better visibility * fix(Navbar): add Linux support for padding adjustment in Navbar component --- src/main/config.ts | 6 +++--- src/main/services/WindowService.ts | 2 +- src/renderer/src/components/app/Navbar.tsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/config.ts b/src/main/config.ts index 23eb0d441f..84dc1b846d 100644 --- a/src/main/config.ts +++ b/src/main/config.ts @@ -12,12 +12,12 @@ export const DATA_PATH = getDataPath() export const titleBarOverlayDark = { height: 40, - color: 'rgba(0,0,0,0)', - symbolColor: '#ffffff' + color: 'rgba(255,255,255,0)', + symbolColor: '#fff' } export const titleBarOverlayLight = { height: 40, color: 'rgba(255,255,255,0)', - symbolColor: '#000000' + symbolColor: '#000' } diff --git a/src/main/services/WindowService.ts b/src/main/services/WindowService.ts index be05cffe70..efbaae5fc8 100644 --- a/src/main/services/WindowService.ts +++ b/src/main/services/WindowService.ts @@ -64,7 +64,7 @@ export class WindowService { transparent: isMac, vibrancy: 'sidebar', visualEffectState: 'active', - titleBarStyle: isLinux ? 'default' : 'hidden', + titleBarStyle: 'hidden', titleBarOverlay: nativeTheme.shouldUseDarkColors ? titleBarOverlayDark : titleBarOverlayLight, backgroundColor: isMac ? undefined : nativeTheme.shouldUseDarkColors ? '#181818' : '#FFFFFF', darkTheme: nativeTheme.shouldUseDarkColors, diff --git a/src/renderer/src/components/app/Navbar.tsx b/src/renderer/src/components/app/Navbar.tsx index 9b0bb823a0..7e74464612 100644 --- a/src/renderer/src/components/app/Navbar.tsx +++ b/src/renderer/src/components/app/Navbar.tsx @@ -1,4 +1,4 @@ -import { isMac, isWindows } from '@renderer/config/constant' +import { isLinux, isMac, isWindows } from '@renderer/config/constant' import useNavBackgroundColor from '@renderer/hooks/useNavBackgroundColor' import type { FC, PropsWithChildren } from 'react' import type { HTMLAttributes } from 'react' @@ -63,6 +63,6 @@ const NavbarRightContainer = styled.div` display: flex; align-items: center; padding: 0 12px; - padding-right: ${isWindows ? '140px' : 12}; + padding-right: ${isWindows ? '140px' : isLinux ? '120px' : '12px'}; justify-content: flex-end; `