3.15插件hexo-next-darkmode

插件hexo-next-darkmode

安装

1
npm install --save hexo-next-darkmode

功能

切换网站的亮暗模式

手动配置文件没成功,只能使用插件

暗黑模式的样式很难看

使用

在next的_config.yml配置文件添加

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Darkmode JS
# For more information: https://github.com/rqh656418510/hexo-next-darkmode, https://github.com/sandoche/Darkmode.js
darkmode_js:
enable: true
bottom: '64px' # default: '32px'
right: 'unset' # default: '32px'
left: '32px' # default: 'unset'
time: '0.5s' # default: '0.3s'
mixColor: 'transparent' # default: '#fff'
backgroundColor: 'transparent' # default: '#fff'
buttonColorDark: '#100f2c' # default: '#100f2c'
buttonColorLight: '#fff' # default: '#fff'
isActivated: false # default false
saveInCookies: true # default: true
label: '🌓' # default: ''
autoMatchOsTheme: true # default: true
libUrl: # Set custom library cdn url for Darkmode.js

参考

Hexo Next 8.x 主题添加可切换的暗黑模式 | Clay 的技术博客 (techgrow.cn)