2026年4月7日
MarkText内置了6款精美主题(包括Cadmium Light、Material Dark、One Dark等),但每个人的审美和写作场景不同。通过自定义CSS主题,你可以调整字体、配色、行高等细节,打造完全符合个人习惯的写作环境。本文将详细介绍MarkText的主题系统以及如何创建自定义主题。
MarkText v0.17.1版本提供以下6款开箱即用主题:
Ctrl + ,)的「Theme」选项卡中选择MarkText支持通过修改CSS变量来自定义主题。主题文件通常位于配置目录下:
%APPDATA%/MarkText/themes/~/Library/Application Support/MarkText/themes/~/.config/marktext/themes/| 变量名 | 作用 | 示例值 |
|---|---|---|
--editor-bg-color |
编辑器背景色 | #ffffff 或 #1e1e1e |
--editor-text-color |
正文文字颜色 | #333333 |
--editor-font-family |
正文字体 | "Source Han Serif SC", serif |
--editor-line-height |
行高 | 1.8 |
--editor-font-size |
字号 | 16px |
--theme-color |
主题强调色 | #409eff |
--selection-bg-color |
选中文本背景色 | #b3d8ff |
针对中文用户的推荐配置方案:
--editor-font-family: "Source Han Serif SC", "Noto Serif CJK SC", "PingFang SC", "Microsoft YaHei", serif;
--editor-code-font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", monospace;
推荐使用"思源宋体"(Source Han Serif)作为正文字体,"JetBrains Mono"作为代码字体,中西文混排更协调。
--editor-line-height: 1.8; /* 中文需要更大行距 */
--editor-font-size: 16px; /* 中文16px阅读舒适 */
--paragraph-spacing: 1.2em; /* 段落间距 */
--editor-bg-color: #1a1a1a;
--editor-text-color: #d1d1d1;
--theme-color: #61afef;
--selection-bg-color: #264f78;
my-themeindex.css 文件你可以将自己创建的主题分享到GitHub,其他用户只需将主题文件夹复制到他们的themes目录即可使用。MarkText社区欢迎优秀的主题设计。
提示:修改主题前建议备份原始文件,或使用版本控制管理你的自定义主题。
想要立即体验主题切换?下载MarkText v0.17.1,内置6款主题一键切换,支持Apple Silicon原生运行,让写作环境随心所欲。
开启优雅写作之旅
sudo snap install marktext (Linux)