Skip to content

Build your personal knowledge base with Trilium Notes

server: Add friendlier names for color themes

Elian Dorandbb5e0e97167
diff --git a/src/services/code_block_theme.ts b/src/services/code_block_theme.ts
index d06694580d..661041d311 100644
--- a/src/services/code_block_theme.ts
+++ b/src/services/code_block_theme.ts
@@ -1,4 +1,5 @@
import fs from "fs";
+import themeNames from "./code_block_theme_names.json" assert { type: "json" }
export function listSyntaxHighlightingThemes() {
const path = "node_modules/@highlightjs/cdn-assets/styles";
@@ -7,10 +8,15 @@ export function listSyntaxHighlightingThemes() {
.filter((el) => el.endsWith(".min.css"))
.map((name) => {
const nameWithoutExtension = name.replace(".min.css", "");
+ let title = nameWithoutExtension.replace(/-/g, " ");
+
+ if (title in themeNames) {
+ title = (themeNames as Record<string, string>)[title];
+ }
return {
val: `default:${nameWithoutExtension}`,
- title: nameWithoutExtension.replace(/-/g, " ")
+ title: title
};
});
return allThemes;
diff --git a/src/services/code_block_theme_names.json b/src/services/code_block_theme_names.json
new file mode 100644
index 0000000000..cb6fc1c042
--- /dev/null
+++ b/src/services/code_block_theme_names.json
@@ -0,0 +1,75 @@
+{
+ "1c light": "1c light",
+ "a11y dark": "a11y dark",
+ "a11y light": "a11y light",
+ "agate": "agate",
+ "an old hope": "an old hope",
+ "androidstudio": "androidstudio",
+ "arduino light": "arduino light",
+ "arta": "arta",
+ "ascetic": "ascetic",
+ "atom one dark reasonable": "Atom One Dark Reasonable",
+ "atom one dark": "Atom One Dark",
+ "atom one light": "Atom One Light",
+ "brown paper": "brown paper",
+ "codepen embed": "codepen embed",
+ "color brewer": "color brewer",
+ "dark": "dark",
+ "default": "default",
+ "devibeans": "devibeans",
+ "docco": "docco",
+ "far": "far",
+ "felipec": "felipec",
+ "foundation": "foundation",
+ "github dark dimmed": "github dark dimmed",
+ "github dark": "github dark",
+ "github": "github",
+ "gml": "gml",
+ "googlecode": "googlecode",
+ "gradient dark": "gradient dark",
+ "gradient light": "gradient light",
+ "grayscale": "grayscale",
+ "hybrid": "hybrid",
+ "idea": "idea",
+ "intellij light": "intellij light",
+ "ir black": "ir black",
+ "isbl editor dark": "isbl editor dark",
+ "isbl editor light": "isbl editor light",
+ "kimbie dark": "kimbie dark",
+ "kimbie light": "kimbie light",
+ "lightfair": "lightfair",
+ "lioshi": "lioshi",
+ "magula": "magula",
+ "mono blue": "mono blue",
+ "monokai sublime": "monokai sublime",
+ "monokai": "monokai",
+ "night owl": "night owl",
+ "nnfx dark": "nnfx dark",
+ "nnfx light": "nnfx light",
+ "nord": "nord",
+ "obsidian": "obsidian",
+ "panda syntax dark": "panda syntax dark",
+ "panda syntax light": "panda syntax light",
+ "paraiso dark": "paraiso dark",
+ "paraiso light": "paraiso light",
+ "pojoaque": "pojoaque",
+ "purebasic": "purebasic",
+ "qtcreator dark": "qtcreator dark",
+ "qtcreator light": "qtcreator light",
+ "rainbow": "rainbow",
+ "routeros": "routeros",
+ "school book": "school book",
+ "shades of purple": "shades of purple",
+ "srcery": "srcery",
+ "stackoverflow dark": "stackoverflow dark",
+ "stackoverflow light": "stackoverflow light",
+ "sunburst": "sunburst",
+ "tokyo night dark": "tokyo night dark",
+ "tokyo night light": "tokyo night light",
+ "tomorrow night blue": "tomorrow night blue",
+ "tomorrow night bright": "tomorrow night bright",
+ "vs": "vs",
+ "vs2015": "vs2015",
+ "xcode": "xcode",
+ "xt256": "xt256"
+}
\ No newline at end of file