feat: changed themes.json style
This commit is contained in:
parent
1a84029031
commit
3f7a03d8b5
@ -1,6 +1,6 @@
|
||||
{
|
||||
"themes": [
|
||||
{
|
||||
"themes": {
|
||||
"dark" : {
|
||||
"name": "Dark",
|
||||
"id": "dark",
|
||||
"description": "Dark",
|
||||
@ -16,5 +16,5 @@
|
||||
"accentColorOrange": "0xFFFEA68D",
|
||||
"accentColorDark": "0xFFF3F3F3"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -3,11 +3,13 @@ function getThemeDetails(id : string) {
|
||||
const json_file = fs.readFileSync("data/themes.json");
|
||||
const json = JSON.parse(json_file);
|
||||
const themes = json.themes;
|
||||
for (let i = 0; i < themes.length; i++) {
|
||||
if (themes[i].id == id) {
|
||||
return themes[i];
|
||||
var theme = {};
|
||||
Object.entries(themes).map(([key, value]) => {
|
||||
if (key == id){
|
||||
theme = (themes[key])
|
||||
}
|
||||
}
|
||||
});
|
||||
return theme
|
||||
}
|
||||
|
||||
module.exports = getThemeDetails;
|
@ -4,17 +4,18 @@ function getThemeList() {
|
||||
const json = JSON.parse(json_file);
|
||||
const themes = json.themes;
|
||||
var themeArray : Array<Object> = [];
|
||||
for (let i = 0; i < themes.length; i++) {
|
||||
// For loop that will look for all the themes in the themes.json file
|
||||
Object.entries(themes).map(([key, value]) => {
|
||||
var theme : Object = {
|
||||
"name": themes[i].name,
|
||||
"id": themes[i].id,
|
||||
"description": themes[i].description,
|
||||
"primary_color": themes[i].primary_color, // Primary color is background color in the theme
|
||||
"secondary_color": themes[i].secondary_color, // Secondary color is the color of the buttonBackPrimary in the theme
|
||||
"tertiary_color": themes[i].tertiary_color, // Tertiary color is the color of the buttonTextPrimary in the theme
|
||||
"name": themes[key].name,
|
||||
"id": themes[key].id,
|
||||
"description": themes[key].description,
|
||||
"primary_color": themes[key].primary_color, // Primary color is background color in the theme
|
||||
"secondary_color": themes[key].secondary_color, // Secondary color is the color of the buttonBackPrimary in the theme
|
||||
"tertiary_color": themes[key].tertiary_color, // Tertiary color is the color of the buttonTextPrimary in the theme
|
||||
}
|
||||
themeArray.push(theme);
|
||||
}
|
||||
})
|
||||
return themeArray;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user