Merge pull request #343 from nickwynja/theme-config
Load theme using existing config mechanisms
This commit is contained in:
commit
519fc499ac
@ -43,4 +43,9 @@ module.exports = (presets, defaultConfigFile) =>
|
||||
default: _.get(presets, "debug", false),
|
||||
type: "boolean"
|
||||
})
|
||||
.options("theme", {
|
||||
describe: "The theme to use, if a theme hasn't been set in the cookies",
|
||||
default: _.get(presets, "theme", "atelier-sulphurPool-light"),
|
||||
type: "string"
|
||||
})
|
||||
.epilog(`The defaults can be configured in ${defaultConfigFile}.`).argv;
|
||||
|
@ -173,8 +173,6 @@ try {
|
||||
// Optional dependency
|
||||
}
|
||||
|
||||
const defaultTheme = "atelier-sulphurPool-light".toLowerCase();
|
||||
|
||||
const readmePath = path.join(__dirname, "..", "README.md");
|
||||
const packagePath = path.join(__dirname, "..", "package.json");
|
||||
|
||||
@ -320,7 +318,7 @@ router
|
||||
ctx.body = await hashtagView({ hashtag, messages });
|
||||
})
|
||||
.get("/theme.css", ctx => {
|
||||
const theme = ctx.cookies.get("theme") || defaultTheme;
|
||||
const theme = ctx.cookies.get("theme") || config.theme;
|
||||
|
||||
const packageName = "@fraction/base16-css";
|
||||
const filePath = `${packageName}/src/base16-${theme}.css`;
|
||||
@ -500,7 +498,7 @@ router
|
||||
ctx.body = await image({ blobId, imageSize: Number(imageSize) });
|
||||
})
|
||||
.get("/settings/", async ctx => {
|
||||
const theme = ctx.cookies.get("theme") || defaultTheme;
|
||||
const theme = ctx.cookies.get("theme") || config.theme;
|
||||
const getMeta = async ({ theme }) => {
|
||||
const status = await meta.status();
|
||||
const peers = await meta.peers();
|
||||
|
@ -125,7 +125,7 @@ module.exports = {
|
||||
],
|
||||
theme: "Theme",
|
||||
themeIntro:
|
||||
"Choose from any theme you'd like. The default theme is Atelier-SulphurPool-Light.",
|
||||
"Choose from any theme you'd like. The default theme is Atelier-SulphurPool-Light. You can also set your theme in the default configuration file.",
|
||||
setTheme: "Set theme",
|
||||
language: "Language",
|
||||
languageDescription:
|
||||
|
Loading…
Reference in New Issue
Block a user