feat(code): display user-selected color themes

This commit is contained in:
Elian Doran
2025-05-11 21:18:14 +03:00
parent af187d1188
commit b2aec4dfdb
6 changed files with 25 additions and 13 deletions

View File

@@ -422,7 +422,6 @@ body.desktop #context-menu-container .dropdown-item > span {
.cm-editor {
height: 100%;
background: inherit;
outline: none !important;
}

View File

@@ -81,10 +81,6 @@ body ::-webkit-calendar-picker-indicator {
filter: invert(1);
}
body .cm-editor {
filter: invert(90%) hue-rotate(180deg);
}
.excalidraw.theme--dark {
--theme-filter: invert(80%) hue-rotate(180deg) !important;
}

View File

@@ -244,10 +244,6 @@ body ::-webkit-calendar-picker-indicator {
filter: invert(1);
}
body .cm-editor {
filter: invert(90%) hue-rotate(180deg);
}
.excalidraw.theme--dark {
--theme-filter: invert(80%) hue-rotate(180deg) !important;
}

View File

@@ -1,3 +1,4 @@
import { getThemeById } from "@triliumnext/codemirror";
import type FNote from "../../entities/fnote.js";
import options from "../../services/options.js";
import TypeWidget from "./type_widget.js";
@@ -31,6 +32,12 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
lineWrapping: options.is("codeLineWrapEnabled"),
...this.getExtraOpts()
});
// Load the theme.
const theme = getThemeById(options.get("codeNoteTheme"));
if (theme) {
await this.codeEditor.setTheme(theme);
}
}
/**