Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 24b6e7a8
authored
Nov 12, 2025
by
米山
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: add global font size adjustment
1 parent
f59e3368
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
31 additions
and
9 deletions
package.json
packages/@core/base/design/src/css/global.css
packages/@core/preferences/src/config.ts
packages/@core/preferences/src/types.ts
packages/@core/preferences/src/update-css-variables.ts
packages/@core/ui-kit/menu-ui/src/components/menu.vue
packages/@core/ui-kit/menu-ui/src/components/normal-menu/normal-menu.vue
packages/effects/layouts/src/widgets/preferences/blocks/index.ts
packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue
packages/locales/src/langs/en-US/preferences.json
packages/locales/src/langs/zh-CN/preferences.json
package.json
View file @
24b6e7a
...
...
@@ -100,7 +100,7 @@
"node"
:
">=20.10.0"
,
"pnpm"
:
">=9.12.0"
},
"packageManager"
:
"pnpm@10.
14
.0"
,
"packageManager"
:
"pnpm@10.
21
.0"
,
"pnpm"
:
{
"peerDependencyRules"
:
{
"allowedVersions"
:
{
...
...
packages/@core/base/design/src/css/global.css
View file @
24b6e7a
...
...
@@ -14,8 +14,9 @@
}
html
{
@apply
text-foreground
bg-background
font-sans
text-[100%]
;
@apply
text-foreground
bg-background
font-sans;
font-size
:
var
(
--font-size-base
,
16px
);
font-variation-settings
:
normal
;
line-height
:
1.15
;
text-size-adjust
:
100%
;
...
...
packages/@core/preferences/src/config.ts
View file @
24b6e7a
...
...
@@ -116,6 +116,7 @@ const defaultPreferences: Preferences = {
colorWarning
:
'hsl(42 84% 61%)'
,
mode
:
'dark'
,
radius
:
'0.5'
,
fontSize
:
16
,
semiDarkHeader
:
false
,
semiDarkSidebar
:
false
,
},
...
...
packages/@core/preferences/src/types.ts
View file @
24b6e7a
...
...
@@ -243,6 +243,8 @@ interface ThemePreferences {
mode
:
ThemeModeType
;
/** 圆角 */
radius
:
string
;
/** 字体大小(单位:px) */
fontSize
:
number
;
/** 是否开启半深色header(只在theme='light'时生效) */
semiDarkHeader
:
boolean
;
/** 是否开启半深色菜单(只在theme='light'时生效) */
...
...
packages/@core/preferences/src/update-css-variables.ts
View file @
24b6e7a
...
...
@@ -66,6 +66,14 @@ function updateCSSVariables(preferences: Preferences) {
if
(
Reflect
.
has
(
theme
,
'radius'
))
{
document
.
documentElement
.
style
.
setProperty
(
'--radius'
,
`
${
radius
}
rem`
);
}
// 更新字体大小
if
(
Reflect
.
has
(
theme
,
'fontSize'
))
{
document
.
documentElement
.
style
.
setProperty
(
'--font-size-base'
,
`
${
theme
.
fontSize
}
px`
,
);
}
}
/**
...
...
packages/@core/ui-kit/menu-ui/src/components/menu.vue
View file @
24b6e7a
...
...
@@ -444,7 +444,7 @@ $namespace: vben;
.
#
{
$namespace
}
-menu__popup-container
,
.
#
{
$namespace
}
-menu
{
--menu-title-width
:
140px
;
--menu-item-icon-size
:
16px
;
--menu-item-icon-size
:
var
(
--font-size-base
,
16px
)
;
--menu-item-height
:
38px
;
--menu-item-padding-y
:
21px
;
--menu-item-padding-x
:
12px
;
...
...
@@ -458,7 +458,7 @@ $namespace: vben;
--menu-item-collapse-margin-x
:
0px
;
--menu-item-radius
:
0px
;
--menu-item-indent
:
16px
;
--menu-font-size
:
14px
;
--menu-font-size
:
calc
(
var
(
--font-size-base
,
16px
)
*
0.875
)
;
&.is-dark
{
--menu-background-color
:
hsl
(
var
(
--menu
));
...
...
@@ -752,7 +752,7 @@ $namespace: vben;
}
.
#
{
$namespace
}
-menu__icon
{
display
:
block
;
font-size
:
20px
!important
;
font-size
:
calc
(
var
(
--font-size-base
,
16px
)
*
1.25
)
!important
;
transition
:
all
0.25s
ease
;
}
...
...
@@ -760,7 +760,7 @@ $namespace: vben;
display
:
inline-flex
;
margin-top
:
8px
;
margin-bottom
:
0
;
font-size
:
12px
;
font-size
:
calc
(
var
(
--font-size-base
,
16px
)
*
0.75
)
;
font-weight
:
400
;
line-height
:
normal
;
transition
:
all
0.25s
ease
;
...
...
packages/@core/ui-kit/menu-ui/src/components/normal-menu/normal-menu.vue
View file @
24b6e7a
...
...
@@ -102,7 +102,7 @@ $namespace: vben;
}
.
#
{
$namespace
}
-normal-menu__icon
{
font-size
:
20px
;
font-size
:
calc
(
var
(
--font-size-base
,
16px
)
*
1.25
)
;
}
}
...
...
@@ -146,14 +146,14 @@ $namespace: vben;
&
__icon
{
max-height
:
20px
;
font-size
:
20px
;
font-size
:
calc
(
var
(
--font-size-base
,
16px
)
*
1.25
)
;
transition
:
all
0.25s
ease
;
}
&
__name
{
margin-top
:
8px
;
margin-bottom
:
0
;
font-size
:
12px
;
font-size
:
calc
(
var
(
--font-size-base
,
16px
)
*
0.75
)
;
font-weight
:
400
;
transition
:
all
0.25s
ease
;
}
...
...
packages/effects/layouts/src/widgets/preferences/blocks/index.ts
View file @
24b6e7a
...
...
@@ -15,5 +15,6 @@ export { default as GlobalShortcutKeys } from './shortcut-keys/global.vue';
export
{
default
as
SwitchItem
}
from
'./switch-item.vue'
;
export
{
default
as
BuiltinTheme
}
from
'./theme/builtin.vue'
;
export
{
default
as
ColorMode
}
from
'./theme/color-mode.vue'
;
export
{
default
as
FontSize
}
from
'./theme/font-size.vue'
;
export
{
default
as
Radius
}
from
'./theme/radius.vue'
;
export
{
default
as
Theme
}
from
'./theme/theme.vue'
;
packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue
View file @
24b6e7a
...
...
@@ -44,6 +44,7 @@ import {
Content
,
Copyright
,
Footer
,
FontSize
,
General
,
GlobalShortcutKeys
,
Header
,
...
...
@@ -85,6 +86,7 @@ const themeColorPrimary = defineModel<string>('themeColorPrimary');
const
themeBuiltinType
=
defineModel
<
BuiltinThemeType
>
(
'themeBuiltinType'
);
const
themeMode
=
defineModel
<
ThemeModeType
>
(
'themeMode'
);
const
themeRadius
=
defineModel
<
string
>
(
'themeRadius'
);
const
themeFontSize
=
defineModel
<
number
>
(
'themeFontSize'
);
const
themeSemiDarkSidebar
=
defineModel
<
boolean
>
(
'themeSemiDarkSidebar'
);
const
themeSemiDarkHeader
=
defineModel
<
boolean
>
(
'themeSemiDarkHeader'
);
...
...
@@ -328,6 +330,9 @@ async function handleReset() {
<Block
:title=
"$t('preferences.theme.radius')"
>
<Radius
v-model=
"themeRadius"
/>
</Block>
<Block
:title=
"$t('preferences.theme.fontSize')"
>
<FontSize
v-model=
"themeFontSize"
/>
</Block>
<Block
:title=
"$t('preferences.other')"
>
<ColorMode
v-model:app-color-gray-mode=
"appColorGrayMode"
...
...
packages/locales/src/langs/en-US/preferences.json
View file @
24b6e7a
...
...
@@ -120,6 +120,8 @@
"theme"
:
{
"title"
:
"Theme"
,
"radius"
:
"Radius"
,
"fontSize"
:
"Font Size"
,
"fontSizeTip"
:
"Adjust global font size with real-time preview"
,
"light"
:
"Light"
,
"dark"
:
"Dark"
,
"darkSidebar"
:
"Semi Dark Sidebar"
,
...
...
packages/locales/src/langs/zh-CN/preferences.json
View file @
24b6e7a
...
...
@@ -120,6 +120,8 @@
"theme"
:
{
"title"
:
"主题"
,
"radius"
:
"圆角"
,
"fontSize"
:
"字体大小"
,
"fontSizeTip"
:
"调整全局字体大小,实时预览效果"
,
"light"
:
"浅色"
,
"dark"
:
"深色"
,
"darkSidebar"
:
"深色侧边栏"
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment