fix(theme): refresh navbar logo on iOS Safari

Replace CSS content substitution with theme-specific navbar background images to ensure WebKit repaints the logo when the system color scheme changes.

Hide the upstream image while preserving its layout dimensions, and use selectors that prevent Gitea's navbar hover styles from clearing the custom logo.
This commit is contained in:
cole-maxwell1
2026-09-07 19:00:10 -05:00
parent 0483209214
commit d8cf7ed29b
3 changed files with 34 additions and 12 deletions
+16 -8
View File
@@ -1,19 +1,27 @@
@import "./theme-codecraftsmen-light.css" (prefers-color-scheme: light);
@import "./theme-codecraftsmen-dark.css" (prefers-color-scheme: dark);
html[data-theme="codecraftsmen-auto"] #navbar #navbar-logo {
background-position: center;
background-repeat: no-repeat;
background-size: 60px 30px;
}
html[data-theme="codecraftsmen-auto"] #navbar #navbar-logo img {
visibility: hidden;
width: 60px;
height: 30px;
}
@media (prefers-color-scheme: light) {
html[data-theme="codecraftsmen-auto"] #navbar-logo img {
content: url("../img/logo-light-no-slogan.svg");
width: 60px;
height: 30px;
html[data-theme="codecraftsmen-auto"] #navbar #navbar-logo {
background-image: url("../img/logo-light-no-slogan.svg");
}
}
@media (prefers-color-scheme: dark) {
html[data-theme="codecraftsmen-auto"] #navbar-logo img {
content: url("../img/logo-dark-no-slogan.svg");
width: 60px;
height: 30px;
html[data-theme="codecraftsmen-auto"] #navbar #navbar-logo {
background-image: url("../img/logo-dark-no-slogan.svg");
}
}
@@ -293,8 +293,15 @@ gitea-theme-meta-info {
--cc-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
html[data-theme="codecraftsmen-dark"] #navbar-logo img {
content: url("../img/logo-dark-no-slogan.svg");
html[data-theme="codecraftsmen-dark"] #navbar #navbar-logo {
background-image: url("../img/logo-dark-no-slogan.svg");
background-position: center;
background-repeat: no-repeat;
background-size: 60px 30px;
}
html[data-theme="codecraftsmen-dark"] #navbar #navbar-logo img {
visibility: hidden;
width: 60px;
height: 30px;
}
@@ -269,8 +269,15 @@ gitea-theme-meta-info {
--cc-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
html[data-theme="codecraftsmen-light"] #navbar-logo img {
content: url("../img/logo-light-no-slogan.svg");
html[data-theme="codecraftsmen-light"] #navbar #navbar-logo {
background-image: url("../img/logo-light-no-slogan.svg");
background-position: center;
background-repeat: no-repeat;
background-size: 60px 30px;
}
html[data-theme="codecraftsmen-light"] #navbar #navbar-logo img {
visibility: hidden;
width: 60px;
height: 30px;
}