mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
Change theme color based on tag color
This commit is contained in:
@@ -12,13 +12,16 @@ export default function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var originalThemeColor = $('meta[name=theme-color]').attr('content');
|
||||||
|
|
||||||
// If currently viewing a tag, insert a tag hero at the top of the
|
// If currently viewing a tag, insert a tag hero at the top of the
|
||||||
// view.
|
// view and set the theme color accordingly.
|
||||||
extend(IndexPage.prototype, 'view', function(view) {
|
extend(IndexPage.prototype, 'view', function(view) {
|
||||||
var tag = this.currentTag();
|
var tag = this.currentTag();
|
||||||
if (tag) {
|
if (tag) {
|
||||||
view.children[0] = TagHero.component({tag});
|
view.children[0] = TagHero.component({tag});
|
||||||
}
|
}
|
||||||
|
$('meta[name=theme-color]').attr('content', tag ? tag.color() : originalThemeColor);
|
||||||
});
|
});
|
||||||
|
|
||||||
// If currently viewing a tag, restyle the 'new discussion' button to use
|
// If currently viewing a tag, restyle the 'new discussion' button to use
|
||||||
|
Reference in New Issue
Block a user