mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 15:55:52 +01:00
server: Add friendlier names for color themes
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user