Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/renderer/src/app-shell/use-document-appearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useShallow } from 'zustand/react/shallow'
import { buildAppFontFamily } from '@/lib/app-font-family'
import { applyCodeFontSmoothing } from '@/lib/code-font-smoothing'
import { applyMarkdownCodeFontFamily } from '@/lib/markdown-code-font'
import { useSplitDividerSetting } from '@/hooks/use-split-divider-setting'
import { rebuildAllTerminalWebglRenderers } from '@/lib/pane-manager/pane-manager-registry'
import { applyDocumentTheme, applyPluginAppTheme } from '../lib/document-theme'
import { applyThemeBackground } from '../lib/theme-background'
Expand Down Expand Up @@ -82,6 +83,7 @@ export function useDocumentAppearance(): void {
const ready = matchTerminal || pluginThemesLoaded
usePluginTerminalPaletteRefresh()
usePluginAppThemeSync()
useSplitDividerSetting()
const appFontFamily = useAppStore((s) => s.settings?.appFontFamily)
const codeFontSmoothing = useAppStore((s) => s.settings?.codeFontSmoothing)
const editorFontFamily = useAppStore((s) => s.settings?.editorFontFamily)
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,8 @@ html.native-shell .app-layout {
content: '';
position: absolute;
border-radius: 1px;
background: var(--split-divider);
/* Set only when Settings changed the divider color from its default. */
background: var(--split-divider-setting, var(--split-divider));
transition: background 100ms ease;
}

Expand Down
30 changes: 30 additions & 0 deletions src/renderer/src/hooks/use-split-divider-setting.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useEffect } from 'react'
import { useAppStore } from '@/store'
import { useSystemPrefersDark } from '@/components/terminal-pane/use-system-prefers-dark'
import { DEFAULT_TERMINAL_DIVIDER_DARK, DEFAULT_TERMINAL_DIVIDER_LIGHT } from '@/lib/terminal-theme'
import { selectTerminalTheme } from '../../../shared/terminal-theme-selection'

/**
* A divider color changed from its default also paints tab-group splits, above any theme token;
* the default stays unset so the built-in 3:1 split color (or the theme's) shows.
*/
export function useSplitDividerSetting(): void {
const systemPrefersDark = useSystemPrefersDark()
// Why the terminal's variant, not the app mode: it is the one field Settings shows, and the one panes paint.
const light = useAppStore((s) =>
s.settings ? selectTerminalTheme(s.settings, systemPrefersDark).useLightVariant : false
)
const color = useAppStore((s) =>
light ? s.settings?.terminalDividerColorLight : s.settings?.terminalDividerColorDark
)
useEffect(() => {
const style = document.documentElement.style
const value = color?.trim()
const fallback = light ? DEFAULT_TERMINAL_DIVIDER_LIGHT : DEFAULT_TERMINAL_DIVIDER_DARK
if (value && value.toLowerCase() !== fallback && CSS.supports('color', value)) {
style.setProperty('--split-divider-setting', value)
} else {
style.removeProperty('--split-divider-setting')
}
}, [color, light])
}
2 changes: 1 addition & 1 deletion src/renderer/src/lib/terminal-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const BUILTIN_TERMINAL_THEME_NAMES = getThemeNames()

export { DEFAULT_TERMINAL_THEME_DARK, DEFAULT_TERMINAL_THEME_LIGHT }
export const DEFAULT_TERMINAL_DIVIDER_DARK = '#3f3f46'
const DEFAULT_TERMINAL_DIVIDER_LIGHT = '#d4d4d8'
export const DEFAULT_TERMINAL_DIVIDER_LIGHT = '#d4d4d8'

export type EffectiveTerminalAppearance = {
mode: 'dark' | 'light'
Expand Down
Loading