From ba46b7841b8bdd9153f76f00621a66f3f5399e48 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Fri, 12 Jul 2019 17:13:27 +0200 Subject: [PATCH] Set theme color depending on DevDocs theme --- assets/javascripts/app/settings.coffee | 4 ++++ views/index.erb | 1 + views/other.erb | 1 + 3 files changed, 6 insertions(+) diff --git a/assets/javascripts/app/settings.coffee b/assets/javascripts/app/settings.coffee index af298250..636da4e0 100644 --- a/assets/javascripts/app/settings.coffee +++ b/assets/javascripts/app/settings.coffee @@ -114,16 +114,20 @@ class app.Settings @toggleDark(@get('dark') is 1) @toggleLayout(layout, @hasLayout(layout)) for layout in @LAYOUTS @initSidebarWidth() + return toggleDark: (enable) -> classList = document.documentElement.classList classList.toggle('_theme-default', !enable) classList.toggle('_theme-dark', enable) + $('meta[name=theme-color]').setAttribute('content', if enable then '#1c1c1c' else '#eee') + return toggleLayout: (layout, enable) -> classList = document.body.classList classList.toggle(layout, enable) unless layout is '_sidebar-hidden' classList.toggle('_overlay-scrollbars', $.overlayScrollbarsEnabled()) + return initSidebarWidth: -> size = @get('size') diff --git a/views/index.erb b/views/index.erb index c161fe3c..4fb96153 100644 --- a/views/index.erb +++ b/views/index.erb @@ -14,6 +14,7 @@ + DevDocs API Documentation diff --git a/views/other.erb b/views/other.erb index 63577029..45cab943 100644 --- a/views/other.erb +++ b/views/other.erb @@ -5,6 +5,7 @@ <% if doc_index_page? %><% else %><% end %> + DevDocs<%= " — #{@doc['full_name']} documentation" if doc_index_page? %>