🔀 Merge pull request #789 from janurskremer/safari-fix

💄 Fix Safari status bar style
pull/791/head
James Panther 2024-01-20 10:58:28 +11:00 committed by GitHub
commit 900a945d0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -8,9 +8,13 @@ function getCSSValue(varName) {
function setThemeColor() { function setThemeColor() {
var metaThemeColor = document.querySelector("meta[name=theme-color]"); var metaThemeColor = document.querySelector("meta[name=theme-color]");
var metaAppleMobileWebAppStatusBarStyle = document.querySelector("meta[name=apple-mobile-web-app-status-bar-style]");
document.documentElement.classList.contains("dark") document.documentElement.classList.contains("dark")
? metaThemeColor.setAttribute("content", getCSSValue("--color-neutral-800")) ? metaThemeColor.setAttribute("content", getCSSValue("--color-neutral-800"))
: metaThemeColor.setAttribute("content", getCSSValue("--color-neutral")); : metaThemeColor.setAttribute("content", getCSSValue("--color-neutral"));
document.documentElement.classList.contains("dark")
? metaAppleMobileWebAppStatusBarStyle.setAttribute("content", getCSSValue("--color-neutral-800"))
: metaAppleMobileWebAppStatusBarStyle.setAttribute("content", getCSSValue("--color-neutral"));
return true; return true;
} }

View File

@ -2,6 +2,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="rgb(255,255,255)" /> <meta name="theme-color" content="rgb(255,255,255)" />
<meta name="apple-mobile-web-app-status-bar-style" content="rgb(255,255,255)" />
{{/* Title */}} {{/* Title */}}
{{ if .IsHome -}} {{ if .IsHome -}}
<title>{{ .Site.Title | emojify }}</title> <title>{{ .Site.Title | emojify }}</title>