fix(theme): switch navbar and home logos through pure css
Extend theme-aware logo switching to the home page hero logo, which previously never changed with the active color scheme, and keep the navbar logo switching in the same CSS-only mechanism. Replace the header template synchronization script with theme CSS background images so logos render correctly at first paint, work with JavaScript disabled, and avoid WebKit replaced-element repaint behavior. Hide the upstream images as layout placeholders and use selectors that outrank Gitea's navbar hover styles. Add an AGENTS.md guide documenting repository scope, theme and template constraints, verification expectations, and the manual deployment flow.
This commit is contained in:
@@ -1,11 +1,53 @@
|
||||
@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;
|
||||
}
|
||||
|
||||
html[data-theme="codecraftsmen-auto"] .page-content.home img.logo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html[data-theme="codecraftsmen-auto"] .page-content.home .center:has(> img.logo)::before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
margin: 0 auto;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
html[data-theme="codecraftsmen-auto"] #navbar #navbar-logo {
|
||||
background-image: url("../img/logo-light-no-slogan.svg");
|
||||
}
|
||||
|
||||
html[data-theme="codecraftsmen-auto"] .page-content.home .center:has(> img.logo)::before {
|
||||
background-image: url("../img/logo-light.svg");
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
html[data-theme="codecraftsmen-auto"] #navbar #navbar-logo {
|
||||
background-image: url("../img/logo-dark-no-slogan.svg");
|
||||
}
|
||||
|
||||
html[data-theme="codecraftsmen-auto"] .page-content.home .center:has(> img.logo)::before {
|
||||
background-image: url("../img/logo-dark.svg");
|
||||
}
|
||||
}
|
||||
|
||||
gitea-theme-meta-info {
|
||||
--theme-display-name: "CodeCraftsmen Auto";
|
||||
--theme-color-scheme: "auto";
|
||||
|
||||
@@ -293,11 +293,35 @@ 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 #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;
|
||||
}
|
||||
|
||||
html[data-theme="codecraftsmen-dark"] .page-content.home img.logo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html[data-theme="codecraftsmen-dark"] .page-content.home .center:has(> img.logo)::before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
margin: 0 auto;
|
||||
background-image: url("../img/logo-dark.svg");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
body,
|
||||
input,
|
||||
textarea,
|
||||
|
||||
@@ -269,11 +269,35 @@ 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 #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;
|
||||
}
|
||||
|
||||
html[data-theme="codecraftsmen-light"] .page-content.home img.logo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html[data-theme="codecraftsmen-light"] .page-content.home .center:has(> img.logo)::before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
margin: 0 auto;
|
||||
background-image: url("../img/logo-light.svg");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
body,
|
||||
input,
|
||||
textarea,
|
||||
|
||||
Reference in New Issue
Block a user