跳转到内容

自定义样式

Switch to Zen Mode

Mutsumi 基于 Textual 框架构建,Textual 使用类 CSS 的样式系统(TCSS)。你可以通过自定义 CSS 文件覆盖默认样式。

config.toml 中指定自定义 CSS 文件路径:

custom_css_path = "~/.config/mutsumi/custom.tcss"

Textual CSS (TCSS) 与 Web CSS 类似,但语法有一些差异。以下是常用属性:

属性说明示例
background背景色background: #1e1e2e;
color文字颜色color: #cdd6f4;
border边框border: solid #333333;
padding内边距padding: 1 2;
margin外边距margin: 0 1;
width宽度width: 100%;
height高度height: auto;
text-style文字样式text-style: bold;
display显示模式display: none;
~/.config/mutsumi/custom.tcss
/* 任务行高亮效果 */
.task-row:hover {
background: #2a2a3a;
}
/* 已完成任务的样式 */
.task-row.done {
color: #6c7086;
text-style: italic;
}
/* 高优先级任务边框 */
.task-row.priority-high {
border-left: thick #f38ba8;
}
/* 标签页激活状态 */
.tab-button:focus {
background: #333333;
text-style: bold;
}
/* 详情面板背景 */
.detail-panel {
background: #1a1a2e;
border: solid #444466;
padding: 1 2;
}
/* 隐藏底部状态栏 */
.footer-bar {
display: none;
}
选择器目标元素
.task-row任务行
.task-row.done已完成的任务
.task-row.priority-high高优先级任务
.task-row.priority-normal普通优先级任务
.task-row.priority-low低优先级任务
.tab-button标签页按钮
.detail-panel详情面板
.footer-bar底部状态栏
.header-bar头部栏
.search-input搜索输入框

Textual CSS 的完整文档请参考:

自定义 CSS 在主题之上应用。加载顺序为:

Textual 默认样式 → 内置/自定义主题 → 自定义 CSS

这意味着自定义 CSS 可以覆盖主题中的任何样式,而不需要修改主题文件本身。