From b8b3f84ef08413a717d509c85478ebaf38b12990 Mon Sep 17 00:00:00 2001 From: Mohamed Yusuf Date: Tue, 16 Jun 2026 15:07:05 +0300 Subject: [PATCH] style(pkgdown): default theme to time of day, not always dark The pre-paint inline script in template.includes.in_header was writing 'dark' to localStorage on any first visit, so every new visitor saw dark mode regardless of when they showed up. That overrode pkgdown's own default-light behaviour and made the navbar light-switch look broken on first paint. New behaviour: if the visitor has clicked the light-switch (saved 'light' or 'dark' in localStorage), respect that. Otherwise pick by local hour - 07:00 inclusive to 19:00 exclusive defaults to light, otherwise dark - and do NOT persist that choice so each visit re-evaluates until the visitor picks one explicitly. --- _pkgdown.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 9a2d9d2..36a2a32 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -7,15 +7,25 @@ template: includes: in_header: |