While using logseq, I always wonder if I can use another code highlighting theme. Note that this is different from choosing a logseq theme, which customize more things.
Digging a bit deeper, here’s what I found
-
Logseq is using CodeMirror, so I should be able to using CodeMirror themes
-
Logseq includes two CodeMirror themes, default and solarized
-
CodeMirror uses different class selector for different themes, for example
.cm-s-material-palenight
in the material-palenight theme..cm-s-material-palenight .cm-keyword { color: #C792EA; }
-
Because of 3, simply
@import url("path_to_theme_css")
incustom.css
won’t work. -
I checked how some logseq themes do it. For example, in logseq-laurel-theme, it modifies the original css. Replacing the more specific class selector with
[class*="cm-s-"]
to make it function.[class*="cm-s-"] .cm-meta { color: #ffcb6b; }
In short, using a different codemirror theme requires copy/paste css, and modify them, which is not ideal.
If you know a better way, please let me know.
I once created a feature request but got no response: