MtcldForum 主题模板
这是 MtcldForum 主题的开发模板,帮助你快速创建一个新主题。
快速开始
1. 修改配置
- 修改
manifest.json中的主题信息(ID、名称、版本等) - 修改
theme.css中的 CSS 变量值
2. 本地预览
在浏览器开发者工具的 Console 中粘贴以下代码可以临时预览:
fetch('/path/to/theme.css').then(r => r.text()).then(css => {
const style = document.createElement('style');
style.textContent = css;
document.head.appendChild(style);
});
3. 发布
chmod +x publish.sh
# 修改 publish.sh 中的 API_KEY
./publish.sh
项目结构
├── manifest.json # 主题元信息
├── theme.css # 主题样式文件
├── publish.sh # 一键发布脚本
└── README.md
CSS 变量速查
| 变量 | 说明 |
|---|---|
--color-bg |
页面主背景色 |
--color-bg-secondary |
卡片/区块背景色 |
--color-bg-tertiary |
输入框/深层背景色 |
--color-text |
主文字颜色 |
--color-text-secondary |
次要文字颜色 |
--color-text-muted |
辅助灰色文字 |
--color-primary |
品牌主色调 |
--color-primary-hover |
主色悬停态 |
--color-border |
边框颜色 |
--color-success |
成功色 |
--color-danger |
危险色 |
--color-warning |
警告色 |
--radius |
全局圆角 |
--shadow |
基础阴影 |
--shadow-lg |
大号阴影 |
配色模式
:root { ... }— 亮色模式变量.dark { ... }— 暗色模式变量- 建议同时支持两种模式(
color_scheme: "both")
文档
详细开发文档请参考: 开发者指南