mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-09-24 15:49:09 +00:00
70607cb26d
Split vault/session/settings into publishers and store-backed Hosts so hot fields no longer rebuild the whole shell, and harden Terminal boot / startup effects for StrictMode double-mounts. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import type React from 'react';
|
|
import { useMemo } from 'react';
|
|
|
|
import { useAppearanceChromeStore } from '../state/appearanceChromeStore';
|
|
import { useSettingsChromeStore } from '../state/settingsChromeStore';
|
|
import { buildAppThemeCssVars } from '../state/settingsStateDefaults';
|
|
import { getUiThemeById } from '../../infrastructure/config/uiThemes';
|
|
|
|
/**
|
|
* App theme CSS variables for surfaces that need them (vault surface, plugin
|
|
* theme tokens). Reads accent from appearanceChromeStore and UI theme ids from
|
|
* settingsChromeStore so accent drags only re-render the leaf that applies the
|
|
* vars, never the App shell.
|
|
*/
|
|
export function useAppThemeStyle(): React.CSSProperties {
|
|
const { accentMode, customAccent } = useAppearanceChromeStore();
|
|
const { resolvedTheme, darkUiThemeId, lightUiThemeId } = useSettingsChromeStore();
|
|
return useMemo(() => {
|
|
const tokens = getUiThemeById(
|
|
resolvedTheme,
|
|
resolvedTheme === 'dark' ? darkUiThemeId : lightUiThemeId,
|
|
).tokens;
|
|
return {
|
|
...buildAppThemeCssVars(tokens, accentMode, customAccent),
|
|
colorScheme: resolvedTheme,
|
|
} as React.CSSProperties;
|
|
}, [accentMode, customAccent, darkUiThemeId, lightUiThemeId, resolvedTheme]);
|
|
}
|