1 import { existsSync } from "fs";
2 import { readdir } from "fs/promises";
4 const extraThemesFolder =
5 process.env["LEMMY_UI_EXTRA_THEMES_FOLDER"] || "./extra_themes";
7 const themes: ReadonlyArray<string> = [
14 export async function buildThemeList(): Promise<ReadonlyArray<string>> {
15 if (existsSync(extraThemesFolder)) {
16 const dirThemes = await readdir(extraThemesFolder);
17 const cssThemes = dirThemes
18 .filter(d => d.endsWith(".css"))
19 .map(d => d.replace(".css", ""));
20 return themes.concat(cssThemes);