Merge pull request #113 from gabe565/custom-stylesheet

Add support for a custom stylesheet
This commit is contained in:
Bastien Wirtz 2020-08-29 10:50:42 -07:00 committed by GitHub
commit 83665e4f48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -26,6 +26,11 @@ connectivityCheck: true # whether you want to display a message when the apps ar
# Optional theming
theme: default # 'default' or one of the theme available in 'src/assets/themes'.
# Optional custom stylesheet
# Will load custom CSS files. Especially useful for custom icon sets.
# stylesheet:
# - "assets/custom.css"
# Here is the exaustive list of customization parameters
# However all value are optional and will fallback to default if not set.
# if you want to change only some of the colors, feel free to remove all unused key.

View File

@ -160,6 +160,13 @@ export default {
this.config = merge(defaults, config);
this.services = this.config.services;
document.title = `${this.config.title} | ${this.config.subtitle}`;
if (this.config.stylesheet) {
let stylesheet = '';
for (const file of this.config.stylesheet) {
stylesheet += `@import "${file}";`;
}
this.createStylesheet(stylesheet);
}
},
methods: {
getConfig: function (path = "assets/config.yml") {
@ -235,6 +242,11 @@ export default {
},
};
},
createStylesheet: function(css) {
let style = document.createElement('style');
style.appendChild(document.createTextNode(css));
document.head.appendChild(style);
},
},
};
</script>