armcord/utils/theme.js

30 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-05-14 16:01:52 +00:00
const fs = require("fs");
2021-05-22 15:29:39 +00:00
const armcord = require("./ArmCord.js");
2021-05-14 20:54:40 +00:00
const themeFolder = __dirname + "/themes/";
2021-05-21 18:19:17 +00:00
2021-05-14 19:47:01 +00:00
window.addEventListener("DOMContentLoaded", () => {
2021-05-21 17:27:32 +00:00
console.log("Theme Module Loaded");
2021-05-14 19:47:01 +00:00
fs.readdirSync(themeFolder).forEach((file) => {
console.log(file);
try {
2021-05-14 20:54:40 +00:00
const manifest = fs.readFileSync(`${__dirname}/themes/${file}/manifest.json`, "utf8");
var themeFile = JSON.parse(manifest);
console.log(themeFile.theme);
console.log(themeFile)
const theme = fs.readFileSync(`${__dirname}/themes/${file}/${themeFile.theme}`, "utf8");
if (themeFile.theme.endsWith(".scss")) {
console.log(
2021-05-22 12:39:46 +00:00
`%cCouldn't load ${themeFile.name} made by ${themeFile.author}. ArmCord doesn't support SCSS files! If you want to have this theme ported, feel free to reach out https://discord.gg/F25bc4RYDt `,
"color:red; font-weight: bold; font-size: 50px;color: red;"
);
}
2021-05-15 10:35:22 +00:00
armcord.addStyle(theme);
2021-05-22 12:39:46 +00:00
var html = `<div id="tm-list-item"><div id="theme-name">${themeFile.name}</div><div id="theme-author">By ${themeFile.author}</div><div id="theme-description">${themeFile.description}</div></div><br><br>`;
document.getElementById("tm-list").innerHTML = html + document.getElementById("tm-list").innerHTML;
2021-05-15 10:35:22 +00:00
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
2021-05-14 19:47:01 +00:00
} catch (err) {
console.error(err);
}
});
2021-05-14 16:01:52 +00:00
});