NEUQ 空闲教室总表 · 主题系统 · Ver 3.0
创建一个 .toml 文件,填写需要自定义的字段,然后在页面底部点击「导入主题」按钮选择该文件即可。未填写的字段自动使用默认值。
也可以直接使用页面底部的预设主题下拉菜单,从 7 个内置主题中一键切换。
# my-theme.toml — 最简示例 name = "我的主题" [light] body_bg = "#f0f4f8" h1_text = "#1a365d" tab_active_text = "#3182ce" tab_active_border = "#3182ce" timeslot_title_text = "#3182ce" link_color = "#3182ce"
assets/themes/ 目录下提供了 7 个预制主题(Tokyo Night、Nord、Catppuccin、Gruvbox、Ayu、Everforest、Kanagawa),可通过下拉菜单直接选择,也可下载 TOML 文件作为编写自定义主题的参考。TOML 文件由以下可选部分组成:
name = "主题名称" # 可选,显示在页面底部 mode = "light" # 可选,锁定明暗模式(见第 3 节) [light] # 亮色模式颜色变量(可选) body_bg = "#f5f5f5" body_text = "#333" [dark] # 暗色模式颜色变量(可选) body_bg = "#1a1a2e" body_text = "#ccc" [layout] # 布局/字号变量(可选,亮暗共用) font_size_header = "24px"
[light] 和 [dark] 分别控制亮色/暗色模式下的样式,[layout] 中的字号在两种模式下共用。默认情况下,页面会跟随操作系统的亮色/暗色偏好自动切换。通过设置顶层 mode 字段,可以锁定为固定模式,不再随系统变化。
# 锁定为亮色模式(无视系统偏好) mode = "light" # 锁定为暗色模式(无视系统偏好) mode = "dark" # 不设置 mode 字段 = 跟随系统(默认行为)
| mode 值 | 行为 |
|---|---|
| 不设置 / 省略 | 跟随操作系统偏好自动切换(默认) |
"light" | 强制亮色模式,忽略系统偏好 |
"dark" | 强制暗色模式,忽略系统偏好 |
mode = "light" 可以防止系统切换到暗色时出现样式不匹配的问题。反之亦然。点击页面上的「重置」按钮后,模式锁定会一并解除,恢复跟随系统偏好。
.toml 文件页面底部的下拉菜单提供了以下内置主题,选择即可即时预览并保存:
| 名称 | 风格 | 文件 |
|---|---|---|
| Ayu | 暖粉调 | ayu.toml |
| Catppuccin | 紫罗兰调 | catppuccin.toml |
| Everforest | 森林绿调 | everforest.toml |
| Gruvbox | 复古暖调 | gruvbox.toml |
| Kanagawa | 朱红调 | kanagawa.toml |
| Nord | 北欧蓝调 | nord.toml |
| Tokyo Night | 冷蓝调都市夜景 | tokyonight.toml |
assets/themes/ 目录下,可下载后修改为自己的主题。颜色值支持任何合法的 CSS 颜色格式:#hex、rgb()、rgba()、hsl() 等。
| TOML 字段 | 控制元素 | 默认值 (亮/暗) |
|---|---|---|
body_bg | 页面整体背景 | #f9f9f9 / #121212 |
badge_bg | 更新状态徽章背景 | #7b7b7b / #888 |
banner_bg | 顶部通知横幅背景 | #f9f9f9 / #121212 |
tab_bar_bg | Tab 栏背景 | #f0f0f0 / #2a2a2a |
tab_active_bg | Tab 激活态背景 | rgba(255,255,255,0.75) / rgba(30,30,30,0.75) |
container_bg | Tab 容器 / 折叠容器背景 | rgba(255,255,255,0.2) / rgba(30,30,30,0.5) |
container_shadow | 容器阴影 | 2px 4px 3px 2px rgba(0,0,0,0.06) / 0px 2px 5px 1px rgba(0,0,0,0.5) |
info_box_bg | 通知框背景 | rgba(138,138,138,0.05) / rgba(213,213,213,0.08) |
| TOML 字段 | 控制元素 | 默认值 (亮/暗) |
|---|---|---|
body_text | 页面正文文字 | #474747 / #bbb |
collapsible_text | 折叠容器标题文字 | #474747 / #bbb |
btn_text | 主题按钮文字(导入/重置) | #474747 / #bbb |
info_text | 信息文本(更新时间、版本号等) | #7b7b7b / #888 |
badge_text | 徽章文字 | #f9f9f9 / #121212 |
banner_text | 横幅文字 | #7b7b7b / #888 |
banner_close_text | 横幅关闭按钮 | #7b7b7b / #888 |
collapsible_desc_text | 折叠区域描述文字 | #7b7b7b / #888 |
theme_name_text | 主题名称显示文字 | #7b7b7b / #888 |
h1_text | 页面大标题 | #3f3f3f / #ccc |
date_display_text | 日期切换器显示文字 | #3f3f3f / #ccc |
| TOML 字段 | 控制元素 | 默认值 (亮/暗) |
|---|---|---|
tab_text | Tab 按钮文字 | #888 / #aaa |
tab_text_hover | Tab 按钮悬停文字 | #000 / #fff |
| TOML 字段 | 控制元素 | 默认值 (亮/暗) |
|---|---|---|
date_btn_hover_bg | 日期切换按钮悬停背景 | #e5e5e5 / #3a3a3a |
tab_hover_bg | Tab 按钮悬停背景 | #e5e5e5 / #3a3a3a |
theme_btn_hover_bg | 主题按钮悬停背景 | #e5e5e5 / #3a3a3a |
| TOML 字段 | 控制元素 | 默认值 (亮/暗) |
|---|---|---|
banner_border | 横幅底边框 | rgba(137,137,137,0.3) / rgba(213,213,213,0.3) |
info_box_border | 通知框边框 | rgba(137,137,137,0.3) / rgba(213,213,213,0.3) |
container_border | Tab 容器边框 | rgba(137,137,137,0.3) / rgba(213,213,213,0.3) |
tab_bar_border | Tab 栏底边框 | #d8d8d8 / #444 |
tab_btn_border | Tab 按钮右边框 | #d8d8d8 / #444 |
hr_border | 分隔线 | #d8d8d8 / #444 |
collapsible_border | 折叠容器边框 | #d8d8d8 / #444 |
collapsible_desc_border | 折叠内容区顶边框 | #d8d8d8 / #444 |
theme_btn_border | 主题按钮边框 | #d8d8d8 / #444 |
| TOML 字段 | 控制元素 | 默认值 (亮/暗) |
|---|---|---|
table_header_text | 表头文字 (th) | inherit |
table_header_bg | 表头背景 (th) | #f7f7f7 / #2c2c2c |
table_border | 表格边框 | #e0e0e0 / #444 |
floor_label_bg | 工学馆楼层标签背景 (1F, 2F...) | #f7f7f7 / #2c2c2c |
floor_label_text | 工学馆楼层标签文字 | inherit |
building_name_bg | 本部其它/南校区教学楼名称行背景 | #f7f7f7 / #2c2c2c |
building_name_text | 本部其它/南校区教学楼名称行文字 | inherit |
info_box_text | 临时通知框文字 | #4f4f4f / #ccc |
| TOML 字段 | 控制元素 | 默认值 (亮/暗) |
|---|---|---|
date_btn_icon | 日期切换箭头图标 | #777 / #d1d1d1 |
tab_active_text | Tab 激活态文字 | #777 / #d1d1d1 |
tab_active_border | Tab 激活态底部边框 | #777 / #d1d1d1 |
timeslot_title_text | 时间段标题文字(如"第 1-2 节") | #777 / #d1d1d1 |
theme_btn_hover_border | 主题按钮悬停边框 | #777 / #d1d1d1 |
| TOML 字段 | 控制元素 | 默认值 (亮/暗) |
|---|---|---|
link_color | 链接文字、下划线装饰色 | #4e4e4e / #c8c8c8 |
strong_color | 加粗文字 (<strong>),表示全天空闲 | rgb(76,76,76) / #ddd |
del_color | 删除线文字 (<del>)、重置按钮悬停边框 | gray / #888 |
布局变量在 [layout] 部分配置,亮暗模式共用。所有值均为合法的 CSS 长度值(如 14px、1.2em、1rem)。
| TOML 字段 | 控制元素 | 默认值 |
|---|---|---|
font_size_table | 表格整体字号 (table, th) | 12px |
font_size_td | 表格单元格字号 (td) | 14px |
font_size_header | 页面大标题字号 (h1) | 22px |
font_size_info | 信息文本字号(更新时间等) | 13px |
font_size_timeslot | 时间段标题字号("第 1-2 节") | 20px |
font_size_tab | Tab 按钮字号 | 17px |
font_size_date | 日期显示字号 | 18px |
800px。只修改一两个变量,其余全部使用默认值:
name = "极简" [light] tab_active_text = "#e74c3c" timeslot_title_text = "#e74c3c"
name = "永夜" mode = "dark" [dark] body_bg = "#0d1117" banner_bg = "#161b22" container_bg = "rgba(13,17,23,0.9)" body_text = "#c9d1d9" h1_text = "#f0f6fc" tab_active_text = "#58a6ff" tab_active_border = "#58a6ff" timeslot_title_text = "#58a6ff" link_color = "#58a6ff"
name = "我的主题" [light] # 背景色 body_bg = "#f0f4f8" banner_bg = "#e2e8f0" tab_bar_bg = "#e8ecf2" tab_active_bg = "#ffffff" container_bg = "rgba(255,255,255,0.85)" container_shadow = "0 4px 20px rgba(0,0,0,0.06)" info_box_bg = "#edf2f7" # 文字色 body_text = "#2d3748" collapsible_text = "#2d3748" btn_text = "#4a5568" info_text = "#718096" badge_text = "#ffffff" banner_text = "#2d3748" banner_close_text = "#718096" collapsible_desc_text = "#718096" theme_name_text = "#718096" h1_text = "#1a202c" date_display_text = "#1a202c" # Tab tab_text = "#4a5568" tab_text_hover = "#1a202c" # Hover date_btn_hover_bg = "#d4dbe5" tab_hover_bg = "#d4dbe5" theme_btn_hover_bg = "#d4dbe5" # 边框 banner_border = "#cbd5e0" info_box_border = "#cbd5e0" container_border = "#d4dbe5" tab_bar_border = "#d4dbe5" tab_btn_border = "#d4dbe5" hr_border = "#e2e8f0" collapsible_border = "#d4dbe5" collapsible_desc_border = "#e2e8f0" theme_btn_border = "#d4dbe5" # 表格 table_header_text = "#2d3748" table_border = "#e2e8f0" table_header_bg = "#edf2f7" floor_label_bg = "#e2e8f0" floor_label_text = "#2d3748" building_name_bg = "#e2e8f0" building_name_text = "#2d3748" info_box_text = "#2d3748" # 强调色 date_btn_icon = "#3182ce" tab_active_text = "#3182ce" tab_active_border = "#3182ce" timeslot_title_text = "#3182ce" theme_btn_hover_border = "#3182ce" # 链接与标记 link_color = "#3182ce" strong_color = "#e53e3e" del_color = "#a0aec0" [dark] body_bg = "#1a202c" banner_bg = "#171923" tab_bar_bg = "#1e2432" tab_active_bg = "#2d3748" container_bg = "rgba(26,32,44,0.88)" container_shadow = "0 4px 20px rgba(0,0,0,0.4)" info_box_bg = "#1e2432" body_text = "#e2e8f0" collapsible_text = "#e2e8f0" btn_text = "#a0aec0" info_text = "#718096" badge_text = "#1a202c" banner_text = "#e2e8f0" banner_close_text = "#718096" collapsible_desc_text = "#718096" theme_name_text = "#718096" h1_text = "#f7fafc" date_display_text = "#f7fafc" tab_text = "#a0aec0" tab_text_hover = "#e2e8f0" date_btn_hover_bg = "#2d3748" tab_hover_bg = "#2d3748" theme_btn_hover_bg = "#2d3748" banner_border = "rgba(45,55,72,0.5)" info_box_border = "rgba(45,55,72,0.5)" container_border = "#2d3748" tab_bar_border = "#2d3748" tab_btn_border = "#2d3748" hr_border = "#2d3748" collapsible_border = "#2d3748" collapsible_desc_border = "#2d3748" theme_btn_border = "#2d3748" table_header_text = "#e2e8f0" table_border = "#2d3748" table_header_bg = "#2d3748" floor_label_bg = "#2d3748" floor_label_text = "#e2e8f0" building_name_bg = "#2d3748" building_name_text = "#e2e8f0" info_box_text = "#e2e8f0" date_btn_icon = "#63b3ed" tab_active_text = "#63b3ed" tab_active_border = "#63b3ed" timeslot_title_text = "#63b3ed" theme_btn_hover_border = "#63b3ed" link_color = "#63b3ed" strong_color = "#fc8181" del_color = "#718096" [layout] font_size_table = "12px" font_size_td = "14px" font_size_header = "22px" font_size_info = "13px" font_size_timeslot = "20px" font_size_tab = "17px" font_size_date = "18px"
请检查 TOML 文件中的字符串值是否用双引号包裹(如 body_bg = "#f5f5f5")。颜色值中包含 # 字符,必须用引号括起来。
只写 [dark] 部分即可,[light] 可以完全省略:
name = "仅暗色" [dark] body_bg = "#0d1117" body_text = "#c9d1d9"
设置 mode = "dark" 即可锁定暗色模式。
不可以。容器宽度固定为 800px,不纳入主题配置。
保存在浏览器 Cookie 中(名称 neuq_theme_config),有效期 1 年。清除浏览器 Cookie 会丢失自定义主题。
NEUQ Classroom Query · Theme Configuration Guide · Ver 3.0