From b799e3bc696a4824ef8921b56be3f30dcfc489a6 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sat, 27 Jun 2015 19:13:21 +0200 Subject: [PATCH] Change theme color based on tag color --- extensions/tags/js/src/add-tag-filter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/tags/js/src/add-tag-filter.js b/extensions/tags/js/src/add-tag-filter.js index 8bc2265e2..cb9835afe 100644 --- a/extensions/tags/js/src/add-tag-filter.js +++ b/extensions/tags/js/src/add-tag-filter.js @@ -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 - // view. + // view and set the theme color accordingly. extend(IndexPage.prototype, 'view', function(view) { var tag = this.currentTag(); if (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