feat: support font selection

This commit is contained in:
Erzbir
2026-08-17 15:49:55 +08:00
parent 4f082af1bf
commit fd72c8cba8
8 changed files with 51 additions and 2 deletions
+3 -1
View File
@@ -11,7 +11,9 @@
- 12 套内置配色 - 12 套内置配色
- 访客配色选择器 - 访客配色选择器
- 常规图标和像素图标切换 - 常规图标和像素图标切换
- JetBrains Mono, 系统字体, 自定义字体和内置像素字体 - 内置 JetBrains Mono, Hack 字体, 可切换
- 可设置为访问者系统字体
- 自定义字体
- 基础行高, 文章段落间距和文章元信息分隔符配置 - 基础行高, 文章段落间距和文章元信息分隔符配置
- 首页公告打字效果 - 首页公告打字效果
- 文章目录和目录展开状态配置 - 文章目录和目录展开状态配置
+10
View File
@@ -20,6 +20,16 @@ spec:
- group: style - group: style
label: 全局样式 label: 全局样式
formSchema: formSchema:
- $formkit: select
label: 默认字体
name: default_font
value: "JetBrains Mono"
options:
- label: "JetBrains Mono"
value: "JetBrains Mono"
- label: "Hack"
value: "Hack"
- $formkit: checkbox - $formkit: checkbox
label: 启用全屏布局 label: 启用全屏布局
name: fullscreen_layout name: fullscreen_layout
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+32
View File
@@ -11,3 +11,35 @@
font-display: swap; font-display: swap;
font-style: normal; font-style: normal;
} }
@font-face {
font-family: 'Hack';
src: url('../fonts/hack-regular.woff2?sha=3114f1256') format('woff2');
font-weight: 400;
font-display: swap;
font-style: normal;
}
@font-face {
font-family: 'Hack';
src: url('../fonts/hack-bold.woff2?sha=3114f1256') format('woff2');
font-weight: 700;
font-display: swap;
font-style: normal;
}
@font-face {
font-family: 'Hack';
src: url('../fonts/hack-italic.woff2?sha=3114f1256') format('woff2');
font-weight: 400;
font-display: swap;
font-style: italic;
}
@font-face {
font-family: 'Hack';
src: url('../fonts/hack-bolditalic.woff2?sha=3114f1256') format('woff2');
font-weight: 700;
font-display: swap;
font-style: italic;
}
+5
View File
@@ -73,6 +73,11 @@
--style-theme-title-divider: [(${theme.config.style.title_divider_style})]; --style-theme-title-divider: [(${theme.config.style.title_divider_style})];
} }
</style> </style>
<style data-no-pjax th:if="${not #strings.isEmpty(theme.config.style.default_font)}" th:inline="css">
:root {
--family-theme-font: [(${theme.config.style.default_font})];
}
</style>
<script data-no-pjax> <script data-no-pjax>
window.TerminalTheme?.applyCustomCss?.(); window.TerminalTheme?.applyCustomCss?.();
</script> </script>