Skip to content

Commit

Permalink
server: Add friendlier names for color themes
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Oct 27, 2024
1 parent b8eb09b commit dbb5e0e
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/services/code_block_theme.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
Expand Down
75 changes: 75 additions & 0 deletions src/services/code_block_theme_names.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit dbb5e0e

Please sign in to comment.