mirror of
https://github.com/hyzendust/hyzendust.github.io.git
synced 2026-04-16 05:38:33 +02:00
Add: Theme switcher
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* RSS Subscribe button */
|
||||
@@ -75,7 +76,12 @@
|
||||
color: var(--foreground-color) !important;
|
||||
}
|
||||
|
||||
/* Auth links */
|
||||
.rss-subscribe__link svg {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
/* Auth links base */
|
||||
.auth-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -91,56 +97,107 @@
|
||||
color 0.2s ease;
|
||||
}
|
||||
|
||||
.auth-link--login {
|
||||
border: 1px solid currentColor;
|
||||
background-color: transparent;
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.auth-link--login:hover {
|
||||
background-color: var(--foreground-color);
|
||||
color: var(--background-color) !important;
|
||||
}
|
||||
|
||||
.auth-link--signup {
|
||||
border: 1px solid currentColor;
|
||||
background-color: transparent;
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.auth-link--signup:hover {
|
||||
background-color: var(--foreground-color);
|
||||
color: var(--background-color) !important;
|
||||
}
|
||||
|
||||
/* Make RSS icon bigger on desktop without affecting button size */
|
||||
.rss-subscribe__link svg {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
/* Auth toggle hidden on desktop, links always visible */
|
||||
.brand__auth-toggle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Dropdown toggle — visible on ALL screens */
|
||||
.brand__auth-check {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.brand__auth-links {
|
||||
display: flex;
|
||||
.brand__auth-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
justify-content: center;
|
||||
gap: 0.2rem;
|
||||
padding: 0.2rem 0.4rem;
|
||||
box-sizing: border-box;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #f26522;
|
||||
background-color: #f26522;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 340;
|
||||
line-height: 1.4;
|
||||
user-select: none;
|
||||
outline: none;
|
||||
transition:
|
||||
background-color 0.2s ease,
|
||||
border-color 0.2s ease,
|
||||
color 0.2s ease;
|
||||
}
|
||||
|
||||
/* Mobile dropdown */
|
||||
.brand__auth-toggle:hover {
|
||||
background-color: transparent;
|
||||
border-color: #f26522;
|
||||
color: #f26522;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.brand__auth-toggle {
|
||||
background-color: transparent;
|
||||
border-color: currentColor;
|
||||
color: var(--foreground-color);
|
||||
}
|
||||
|
||||
.brand__auth-toggle:hover,
|
||||
.brand__auth:focus-within .brand__auth-toggle {
|
||||
background-color: var(--foreground-color) !important;
|
||||
border-color: var(--foreground-color) !important;
|
||||
color: var(--background-color) !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dropdown panel — hidden by default, shown on focus-within */
|
||||
.brand__auth-links {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: calc(100% + 0.4rem);
|
||||
right: 0;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
background-color: var(--background-color);
|
||||
border: 1px solid var(--background-color1);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
|
||||
z-index: 100;
|
||||
min-width: 110px;
|
||||
}
|
||||
|
||||
.brand__auth:focus-within .brand__auth-links {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.brand__auth-links .auth-link {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
padding: 0.55rem 1rem;
|
||||
font-size: 0.78rem;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
background-color: transparent;
|
||||
color: var(--foreground-color) !important;
|
||||
}
|
||||
|
||||
.brand__auth-links .auth-link:not(:last-child) {
|
||||
border-bottom: 1px solid var(--background-color1);
|
||||
}
|
||||
|
||||
.brand__auth-links .auth-link:hover {
|
||||
background-color: var(--background-color1);
|
||||
color: var(--foreground-color) !important;
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media (max-width: 600px) {
|
||||
/* RSS outline on mobile */
|
||||
.rss-subscribe__link {
|
||||
background-color: transparent !important;
|
||||
color: var(--foreground-color) !important;
|
||||
border-color: currentColor;
|
||||
width: 1.6rem;
|
||||
height: 1.6rem;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.rss-subscribe__link:hover {
|
||||
@@ -148,127 +205,148 @@
|
||||
color: var(--background-color) !important;
|
||||
}
|
||||
|
||||
/* Orange filled dropdown toggle on mobile light mode */
|
||||
.rss-subscribe__link span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.rss-subscribe__link svg {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.brand__auth-text {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.brand__auth-toggle {
|
||||
width: 1.6rem;
|
||||
height: 1.6rem;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Mobile auth toggle colors ── */
|
||||
|
||||
/* Default (system light): orange filled */
|
||||
@media (max-width: 600px) {
|
||||
.brand__auth-toggle {
|
||||
background-color: #f26522 !important;
|
||||
border-color: #f26522 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.brand__auth-toggle:hover {
|
||||
.brand__auth:focus-within .brand__auth-toggle {
|
||||
background-color: transparent !important;
|
||||
border-color: #f26522 !important;
|
||||
color: #f26522 !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* System dark: outline */
|
||||
@media (max-width: 600px) and (prefers-color-scheme: dark) {
|
||||
.brand__auth-toggle {
|
||||
background-color: transparent !important;
|
||||
border-color: currentColor !important;
|
||||
color: var(--foreground-color) !important;
|
||||
}
|
||||
|
||||
.brand__auth:focus-within .brand__auth-toggle {
|
||||
background-color: var(--foreground-color) !important;
|
||||
border-color: var(--foreground-color) !important;
|
||||
color: var(--background-color) !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Manual light override */
|
||||
@media (max-width: 600px) {
|
||||
[data-theme="light"] .brand__auth-toggle {
|
||||
background-color: #f26522 !important;
|
||||
border-color: #f26522 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
[data-theme="light"] .brand__auth:focus-within .brand__auth-toggle {
|
||||
background-color: transparent !important;
|
||||
border-color: #f26522 !important;
|
||||
color: #f26522 !important;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.brand__auth-toggle {
|
||||
background-color: transparent !important;
|
||||
border-color: currentColor !important;
|
||||
color: var(--foreground-color) !important;
|
||||
}
|
||||
|
||||
.brand__auth-toggle:hover,
|
||||
.brand__auth:focus-within .brand__auth-toggle {
|
||||
background-color: var(--foreground-color) !important;
|
||||
border-color: var(--foreground-color) !important;
|
||||
color: var(--background-color) !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide subscribe text, icon only */
|
||||
.rss-subscribe__link span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.rss-subscribe__link,
|
||||
.brand__auth-toggle {
|
||||
height: 1.6rem;
|
||||
width: 1.6rem;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Make RSS icon bigger without affecting button size */
|
||||
.rss-subscribe__link svg {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.brand__auth {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Show toggle button */
|
||||
.brand__auth-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.15rem;
|
||||
padding: 0.2rem 0.4rem;
|
||||
border-radius: 3px;
|
||||
border: 1px solid currentColor;
|
||||
background: transparent;
|
||||
color: var(--foreground-color);
|
||||
cursor: pointer;
|
||||
font-size: 0.7rem;
|
||||
line-height: 1;
|
||||
user-select: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.brand__auth-toggle:hover {
|
||||
background-color: var(--background-color1);
|
||||
}
|
||||
|
||||
.brand__auth-chevron {
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
/* Open dropdown on focus-within — closes when user taps outside */
|
||||
.brand__auth:focus-within .brand__auth-links {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.brand__auth:focus-within .brand__auth-chevron {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/* Dropdown panel */
|
||||
.brand__auth-links {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: calc(100% + 0.4rem);
|
||||
right: 0;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
background-color: var(--background-color);
|
||||
border: 1px solid var(--background-color1);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
|
||||
z-index: 100;
|
||||
min-width: 110px;
|
||||
}
|
||||
|
||||
.brand__auth-links .auth-link {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
padding: 0.55rem 1rem;
|
||||
font-size: 0.78rem;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
background-color: transparent;
|
||||
/* Manual dark override */
|
||||
[data-theme="dark"] .brand__auth-toggle {
|
||||
background-color: transparent !important;
|
||||
border-color: currentColor !important;
|
||||
color: var(--foreground-color) !important;
|
||||
}
|
||||
|
||||
.brand__auth-links .auth-link:not(:last-child) {
|
||||
border-bottom: 1px solid var(--background-color1);
|
||||
}
|
||||
|
||||
.brand__auth-links .auth-link:hover {
|
||||
background-color: var(--background-color1);
|
||||
color: var(--foreground-color) !important;
|
||||
[data-theme="dark"] .brand__auth:focus-within .brand__auth-toggle {
|
||||
background-color: var(--foreground-color) !important;
|
||||
border-color: var(--foreground-color) !important;
|
||||
color: var(--background-color) !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Theme switcher ── */
|
||||
|
||||
/* Force light theme */
|
||||
[data-theme="light"] {
|
||||
--background-color: #fbf1c7;
|
||||
--background-color1: #ebdbb2;
|
||||
--foreground-color: #3c3836;
|
||||
--foreground-color3: #665c54;
|
||||
--accent-color: #af3a03;
|
||||
}
|
||||
|
||||
/* Force dark theme */
|
||||
[data-theme="dark"] {
|
||||
--background-color: #171414;
|
||||
--background-color1: #fff;
|
||||
--foreground-color: #e3e1db;
|
||||
--foreground-color3: #ccc3b3;
|
||||
--accent-color: #fff;
|
||||
}
|
||||
|
||||
.theme-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.2rem 0.4rem;
|
||||
border-radius: 3px;
|
||||
border: 1px solid currentColor;
|
||||
background: transparent;
|
||||
color: var(--foreground-color);
|
||||
cursor: pointer;
|
||||
font-size: 0.7rem;
|
||||
line-height: 1.4;
|
||||
transition:
|
||||
background-color 0.2s ease,
|
||||
color 0.2s ease;
|
||||
}
|
||||
|
||||
.theme-toggle:hover {
|
||||
background-color: var(--foreground-color);
|
||||
color: var(--background-color);
|
||||
}
|
||||
|
||||
/* Show sun in dark mode (click to go light), moon in light mode (click to go dark) */
|
||||
.theme-toggle__sun { display: none; }
|
||||
.theme-toggle__moon { display: block; }
|
||||
|
||||
[data-theme="dark"] .theme-toggle__sun { display: block; }
|
||||
[data-theme="dark"] .theme-toggle__moon { display: none; }
|
||||
|
||||
[data-theme="light"] .theme-toggle__sun { display: none; }
|
||||
[data-theme="light"] .theme-toggle__moon { display: block; }
|
||||
|
||||
/* Match size to other buttons on mobile */
|
||||
@media (max-width: 600px) {
|
||||
.theme-toggle {
|
||||
width: 1.6rem;
|
||||
height: 1.6rem;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.theme-toggle__text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user