微信小程序如何实现或开启暗黑模式?
- 内容介绍
- 文章标签
- 相关推荐
本文共计556个文字,预计阅读时间需要3分钟。
1. 启用暗黑模式 在`app.json`中配置`darkmode`为`true`: json { darkmode: true }
2. 设置主题文件 在根目录下新建`theme.json`主题配置文件,并在`app.json`中引入: json { themeLocation: theme.json }
1、开启暗黑模式
在 app.json 中配置 "darkmode": true
// app.json { ... "darkmode": true }
2、配置主题文件
在根目录新建主题配置文件 theme.json, 并在 app.json 中配置路径引入
// app.json { ... "themeLocation": "theme.json" }
theme.json 配置文件一共分为两个属性,light 和 dark,分别正常模式和暗黑模式。
本文共计556个文字,预计阅读时间需要3分钟。
1. 启用暗黑模式 在`app.json`中配置`darkmode`为`true`: json { darkmode: true }
2. 设置主题文件 在根目录下新建`theme.json`主题配置文件,并在`app.json`中引入: json { themeLocation: theme.json }
1、开启暗黑模式
在 app.json 中配置 "darkmode": true
// app.json { ... "darkmode": true }
2、配置主题文件
在根目录新建主题配置文件 theme.json, 并在 app.json 中配置路径引入
// app.json { ... "themeLocation": "theme.json" }
theme.json 配置文件一共分为两个属性,light 和 dark,分别正常模式和暗黑模式。

