目前Logseq不支持切换内置代码编辑器(codemirror)主题,所以在官方支持之前,需要我们自己在custom.css
里面替换/覆盖默认codemirror的样式。
CodeMirror官方提供了一些主题,你也可以在社区里找到一些其他的主题。
以 material 为例。
- 将 CodeMirror/material.css at master · codemirror/CodeMirror · GitHub 的内容粘贴入 custom.css
- 全文替换
.cm-s-material
为.cm-s-default
待custom.css的修改生效,你将会看到 codemirror 的主题切换为 material。效果如下
完整的css
.cm-s-default.CodeMirror {
background-color: #263238;
color: #EEFFFF;
}
.cm-s-default .CodeMirror-gutters {
background: #263238;
color: #546E7A;
border: none;
}
.cm-s-default .CodeMirror-guttermarker,
.cm-s-default .CodeMirror-guttermarker-subtle,
.cm-s-default .CodeMirror-linenumber {
color: #546E7A;
}
.cm-s-default .CodeMirror-cursor {
border-left: 1px solid #FFCC00;
}
.cm-s-default div.CodeMirror-selected {
background: rgba(128, 203, 196, 0.2);
}
.cm-s-default.CodeMirror-focused div.CodeMirror-selected {
background: rgba(128, 203, 196, 0.2);
}
.cm-s-default .CodeMirror-line::selection,
.cm-s-default .CodeMirror-line>span::selection,
.cm-s-default .CodeMirror-line>span>span::selection {
background: rgba(128, 203, 196, 0.2);
}
.cm-s-default .CodeMirror-line::-moz-selection,
.cm-s-default .CodeMirror-line>span::-moz-selection,
.cm-s-default .CodeMirror-line>span>span::-moz-selection {
background: rgba(128, 203, 196, 0.2);
}
.cm-s-default .CodeMirror-activeline-background {
background: rgba(0, 0, 0, 0.5);
}
.cm-s-default .cm-keyword {
color: #C792EA;
}
.cm-s-default .cm-operator {
color: #89DDFF;
}
.cm-s-default .cm-variable-2 {
color: #EEFFFF;
}
.cm-s-default .cm-variable-3,
.cm-s-default .cm-type {
color: #f07178;
}
.cm-s-default .cm-builtin {
color: #FFCB6B;
}
.cm-s-default .cm-atom {
color: #F78C6C;
}
.cm-s-default .cm-number {
color: #FF5370;
}
.cm-s-default .cm-def {
color: #82AAFF;
}
.cm-s-default .cm-string {
color: #C3E88D;
}
.cm-s-default .cm-string-2 {
color: #f07178;
}
.cm-s-default .cm-comment {
color: #546E7A;
}
.cm-s-default .cm-variable {
color: #f07178;
}
.cm-s-default .cm-tag {
color: #FF5370;
}
.cm-s-default .cm-meta {
color: #FFCB6B;
}
.cm-s-default .cm-attribute {
color: #C792EA;
}
.cm-s-default .cm-property {
color: #C792EA;
}
.cm-s-default .cm-qualifier {
color: #DECB6B;
}
.cm-s-default .cm-variable-3,
.cm-s-default .cm-type {
color: #DECB6B;
}
.cm-s-default .cm-error {
color: rgba(255, 255, 255, 1.0);
background-color: #FF5370;
}
.cm-s-default .CodeMirror-matchingbracket {
text-decoration: underline;
color: white !important;
}