| | |
| | | import type { Preferences } from './types'; |
| | | |
| | | import { generatorColorVariables } from '..\..\base\shared\src\color'; |
| | | import { updateCSSVariables as executeUpdateCSSVariables } from '..\..\base\shared\src\utils'; |
| | | import { generatorColorVariables } from '../../base/shared/src/color'; |
| | | import { updateCSSVariables as executeUpdateCSSVariables } from '../../base/shared/src/utils'; |
| | | |
| | | import { BUILT_IN_THEME_PRESETS } from './constants'; |
| | | |
| | |
| | | document.documentElement.style.setProperty('--radius', `${radius}rem`); |
| | | } |
| | | |
| | | // 更新字体大小 |
| | | // 更新全局字体大小 |
| | | if (Reflect.has(theme, 'fontSize')) { |
| | | const fontSize = theme.fontSize; |
| | | document.documentElement.style.setProperty( |
| | | '--font-size-base', |
| | | `${fontSize}px`, |
| | | ); |
| | | } |
| | | |
| | | // 更新菜单字号(独立于全局字体大小,可在偏好设置中调整) |
| | | const navigation = preferences?.navigation; |
| | | if (navigation && Reflect.has(navigation, 'fontSize')) { |
| | | document.documentElement.style.setProperty( |
| | | '--menu-font-size', |
| | | `calc(${fontSize}px * 0.875)`, |
| | | `${navigation.fontSize}px`, |
| | | ); |
| | | } |
| | | |
| | | // 更新首页字号缩放比例(百分比转换为倍数,供首页样式 calc 使用) |
| | | const app = preferences?.app; |
| | | if (app && Reflect.has(app, 'homeFontSize')) { |
| | | root.style.setProperty( |
| | | '--portal-font-scale', |
| | | String(app.homeFontSize / 100), |
| | | ); |
| | | } |
| | | } |