feat: add option to use system font

This commit is contained in:
Erzbir
2025-08-08 01:09:45 +08:00
parent 2db10f0bee
commit a87c97dd72
3 changed files with 16 additions and 2 deletions
+5
View File
@@ -28,6 +28,11 @@ spec:
- group: style - group: style
label: 样式设置 label: 样式设置
formSchema: formSchema:
- $formkit: checkbox
label: 使用系统字体
name: system_font
value: false
help: 开启后将优先使用访问者的系统字体
- $formkit: checkbox - $formkit: checkbox
name: pixel_style name: pixel_style
label: 像素化风格 label: 像素化风格
+7 -2
View File
@@ -15,8 +15,9 @@
--line-theme-height: calc(var(--font-theme-size) * 1.54); --line-theme-height: calc(var(--font-theme-size) * 1.54);
--radius-theme-default: 0; --radius-theme-default: 0;
--font-theme-default: 'JetBrains Mono'; --font-theme-default: 'JetBrains Mono';
--font-theme-fallback: Monaco, Consolas, -apple-system, BlinkMacSystemFont, 'segoe ui', --font-theme-fallback: -apple-system, BlinkMacSystemFont, 'segoe ui', Roboto, Oxygen,
Roboto, Oxygen, Ubuntu, Cantarell, 'open sans', 'helvetica neue'; Ubuntu, Cantarell, 'open sans', 'helvetica neue', Arial, 'Noto Sans',
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
--scrollbar-theme-width: thin; --scrollbar-theme-width: thin;
--scrollbar-theme-color: rgba(134, 134, 134, 0.45) rgba(255, 255, 255, 0); --scrollbar-theme-color: rgba(134, 134, 134, 0.45) rgba(255, 255, 255, 0);
--font-theme-lig: none; --font-theme-lig: none;
@@ -31,6 +32,10 @@ html[pixel_style='true'] {
--font-theme-default: 'Fusion Pixel 12px P zh_hans'; --font-theme-default: 'Fusion Pixel 12px P zh_hans';
} }
html[system_font='true']:not([pixel_style='true']) {
--font-theme-default: var(--font-theme-fallback);
}
* { * {
scrollbar-width: var(--scrollbar-theme-width) !important; scrollbar-width: var(--scrollbar-theme-width) !important;
scrollbar-color: var(--scrollbar-theme-color); scrollbar-color: var(--scrollbar-theme-color);
+4
View File
@@ -8,6 +8,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title th:text="${title}"></title> <title th:text="${title}"></title>
<script no-pjax th:inline="javascript">
let system_font = /*[[${theme.config.style.system_font}]]*/;
document.documentElement.setAttribute("system_font", system_font);
</script>
<script no-pjax th:inline="javascript"> <script no-pjax th:inline="javascript">
let dark_theme = /*[[${theme.config.style.dark_color_schema}]]*/; let dark_theme = /*[[${theme.config.style.dark_color_schema}]]*/;
let light_theme = /*[[${theme.config.style.light_color_schema}]]*/; let light_theme = /*[[${theme.config.style.light_color_schema}]]*/;