Skip to content

Build your personal knowledge base with Trilium Notes

style/backend log: extract the syntax highlighting colors

Adorian Doran811571b21d19
diff --git a/apps/client/src/stylesheets/theme-next-dark.css b/apps/client/src/stylesheets/theme-next-dark.css
index a1272c1052..5f279d2507 100644
--- a/apps/client/src/stylesheets/theme-next-dark.css
+++ b/apps/client/src/stylesheets/theme-next-dark.css
@@ -278,6 +278,7 @@
--log-status-client-error-color: #d29922;
--log-status-server-error-color: #e5534b;
--log-error-color: #e5534b;
+ --log-error-line-background-color: transparent; /* Placeholder: give it a tint to highlight the whole error line. */
--log-info-color: inherit; /* Placeholder: give it a colour to make info lines stand out. */
--card-background-color: #ffffff12;
diff --git a/apps/client/src/stylesheets/theme-next-light.css b/apps/client/src/stylesheets/theme-next-light.css
index 9010c274b9..ff0a688c1c 100644
--- a/apps/client/src/stylesheets/theme-next-light.css
+++ b/apps/client/src/stylesheets/theme-next-light.css
@@ -276,6 +276,7 @@
--log-status-client-error-color: #9a6700;
--log-status-server-error-color: #cf222e;
--log-error-color: #cf222e;
+ --log-error-line-background-color: transparent; /* Placeholder: give it a tint to highlight the whole error line. */
--log-info-color: inherit; /* Placeholder: give it a colour to make info lines stand out. */
--card-background-color: #0000000d;
diff --git a/packages/codemirror/src/extensions/trilium_log_highlighter.ts b/packages/codemirror/src/extensions/trilium_log_highlighter.ts
index 8358d8e955..58aba4fa06 100644
--- a/packages/codemirror/src/extensions/trilium_log_highlighter.ts
+++ b/packages/codemirror/src/extensions/trilium_log_highlighter.ts
@@ -61,7 +61,12 @@ const logHighlightTheme = EditorView.baseTheme({
".cm-log-status-3xx": { color: "var(--log-status-redirect-color, var(--muted-text-color))" },
".cm-log-status-4xx": { color: "var(--log-status-client-error-color, #d29922)" },
".cm-log-status-5xx": { color: "var(--log-status-server-error-color, #e5534b)" },
- ".cm-log-error": { color: "var(--log-error-color, #e5534b)", backgroundColor: "transparent" },
+ ".cm-log-error": {
+ color: "var(--log-error-color, #e5534b)",
+ // Transparent by default — set `--log-error-line-background-color` to tint the whole line
+ // the way `.cm-log-http` is.
+ backgroundColor: "var(--log-error-line-background-color, transparent)"
+ },
// Placeholder: no colour yet — set `--log-info-color` to activate.
".cm-log-info": { color: "var(--log-info-color, inherit)" }
});