mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-30 19:52:28 +08:00
server: Add friendlier names for color themes
This commit is contained in:
parent
b8eb09b46b
commit
dbb5e0e971
@ -1,4 +1,5 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
import themeNames from "./code_block_theme_names.json" assert { type: "json" }
|
||||||
|
|
||||||
export function listSyntaxHighlightingThemes() {
|
export function listSyntaxHighlightingThemes() {
|
||||||
const path = "node_modules/@highlightjs/cdn-assets/styles";
|
const path = "node_modules/@highlightjs/cdn-assets/styles";
|
||||||
@ -7,10 +8,15 @@ export function listSyntaxHighlightingThemes() {
|
|||||||
.filter((el) => el.endsWith(".min.css"))
|
.filter((el) => el.endsWith(".min.css"))
|
||||||
.map((name) => {
|
.map((name) => {
|
||||||
const nameWithoutExtension = name.replace(".min.css", "");
|
const nameWithoutExtension = name.replace(".min.css", "");
|
||||||
|
let title = nameWithoutExtension.replace(/-/g, " ");
|
||||||
|
|
||||||
|
if (title in themeNames) {
|
||||||
|
title = (themeNames as Record<string, string>)[title];
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
val: `default:${nameWithoutExtension}`,
|
val: `default:${nameWithoutExtension}`,
|
||||||
title: nameWithoutExtension.replace(/-/g, " ")
|
title: title
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return allThemes;
|
return allThemes;
|
||||||
|
75
src/services/code_block_theme_names.json
Normal file
75
src/services/code_block_theme_names.json
Normal file
@ -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"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user