mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
This code should only run once
This commit is contained in:
parent
043cc9f12c
commit
da0a918c18
@ -76,6 +76,17 @@ export class ThemeLoader {
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Add the default-theme as an additional option to the mapping
|
||||||
|
const defaultThemeId = this.getDefaultTheme();
|
||||||
|
if (defaultThemeId) {
|
||||||
|
const themeDetails = this._findThemeDetailsFromId(defaultThemeId);
|
||||||
|
if (themeDetails) {
|
||||||
|
this._themeMapping["Default"] = { id: "default", cssLocation: themeDetails.cssLocation };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.log({ l: "Default Theme", theme: defaultThemeId});
|
||||||
|
log.log({ l: "Preferred colorscheme", scheme: this.preferredColorScheme === ColorSchemePreference.Dark ? "dark" : "light" });
|
||||||
|
log.log({ l: "Result", themeMapping: this._themeMapping });
|
||||||
Object.assign(this._themeMapping, this._themeBuilder.themeMapping);
|
Object.assign(this._themeMapping, this._themeBuilder.themeMapping);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -150,17 +161,6 @@ export class ThemeLoader {
|
|||||||
const variant = defaultDarkVariant.id ? defaultDarkVariant : defaultLightVariant;
|
const variant = defaultDarkVariant.id ? defaultDarkVariant : defaultLightVariant;
|
||||||
this._themeMapping[`${themeName} ${variant.variantName}`] = { id: variant.id, cssLocation: variant.cssLocation };
|
this._themeMapping[`${themeName} ${variant.variantName}`] = { id: variant.id, cssLocation: variant.cssLocation };
|
||||||
}
|
}
|
||||||
//Add the default-theme as an additional option to the mapping
|
|
||||||
const defaultThemeId = this.getDefaultTheme();
|
|
||||||
if (defaultThemeId) {
|
|
||||||
const themeDetails = this._findThemeDetailsFromId(defaultThemeId);
|
|
||||||
if (themeDetails) {
|
|
||||||
this._themeMapping["Default"] = { id: "default", cssLocation: themeDetails.cssLocation };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
l.log({ l: "Default Theme", theme: defaultThemeId});
|
|
||||||
l.log({ l: "Preferred colorscheme", scheme: this.preferredColorScheme === ColorSchemePreference.Dark ? "dark" : "light" });
|
|
||||||
l.log({ l: "Result", themeMapping: this._themeMapping });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user