From e885fdfbcb9c81104c04430e62810be9b466740d Mon Sep 17 00:00:00 2001 From: XPoet Date: Sun, 9 Oct 2022 14:51:05 +0800 Subject: [PATCH] feat(config): added font size and font family settings (#68) --- _config.yml | 8 ++++++++ source/css/common/variables.styl | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/_config.yml b/_config.yml index b12c710..da65295 100644 --- a/_config.yml +++ b/_config.yml @@ -34,6 +34,14 @@ style: # Avatar (You can use local image or image external link) avatar: /images/avatar.svg + # Font size, customize font size. (you don't usually have to fill) + # e.g. font_size: 18px + font_size: + + # Font family, customize font family. (you don't usually have to fill) + # e.g. font_family: STKaiti, STSong, STHeiti + font_family: + # Left side TOC width (you don't usually have to change it) left_side_width: 260px diff --git a/source/css/common/variables.styl b/source/css/common/variables.styl index f7fe4b0..a15032c 100644 --- a/source/css/common/variables.styl +++ b/source/css/common/variables.styl @@ -111,10 +111,13 @@ $dark-pjax-progress-bar-color = linear-gradient(45deg, #ea404a, #ea722f, #e9a71f // ============================================================================================== -// font +// font settings // ============================================================================================== -$default-font-family = Optima-Regular, Optima, -apple-system, system-ui, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial -$default-font-size = 15.2px +$preset-font-family = Optima-Regular, Optima, -apple-system, system-ui, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial +$custom-font-family = hexo-config('style.font_family') +$default-font-family = $custom-font-family ? convert($custom-font-family) : $preset-font-family +$custom-font-size = hexo-config('style.font_size') +$default-font-size = $custom-font-size ? convert($custom-font-size) : 15.2px $default-font-line-height = 22px $default-font-weight = 400