feat: add menu font size variable and update related components

- Introduced a new CSS variable `--menu-font-size` calculated from the base font size.
- Updated `PreferenceManager` to trigger CSS variable updates when `fontSize` is modified.
- Adjusted `updateCSSVariables` to set the new `--menu-font-size` based on the theme's font size.
- Ensured that the menu components utilize the updated font size with `!important` to maintain styling consistency.
This commit is contained in:
米山
2025-11-19 10:51:10 +08:00
parent c142af482b
commit aaf0274fe9
4 changed files with 19 additions and 5 deletions

View File

@@ -69,9 +69,14 @@ function updateCSSVariables(preferences: Preferences) {
// 更新字体大小
if (Reflect.has(theme, 'fontSize')) {
const fontSize = theme.fontSize;
document.documentElement.style.setProperty(
'--font-size-base',
`${theme.fontSize}px`,
`${fontSize}px`,
);
document.documentElement.style.setProperty(
'--menu-font-size',
`calc(${fontSize}px * 0.875)`,
);
}
}