Add dark mode theme switcher
This commit is contained in:
1 parent
3cf07d0e1b
commit
4bf7dc2586
2 files changed
+224
-22
No files matched your search
+164
-21
@@ -1,41 +1,146 @@
|
||||
/* App-wide theme tokens
|
||||
Keep Open Props' sizing/spacing, but pin semantic colors to a readable
|
||||
light theme so pages do not inherit low-contrast dark-mode surfaces. */
|
||||
/* App-wide theme tokens.
|
||||
Dark is the default. The data-theme attribute is set by js/auth.js. */
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
--app-bg: #121820;
|
||||
--app-panel: #1c232b;
|
||||
--app-panel-soft: #242d37;
|
||||
--app-border: #46515f;
|
||||
--app-text: #f4f7fb;
|
||||
--app-text-muted: #b8c4d3;
|
||||
--app-link: #8cb4ff;
|
||||
--app-accent: #5d7cff;
|
||||
--app-focus: #8cb4ff;
|
||||
--surface-1: var(--app-panel);
|
||||
--surface-2: var(--app-panel-soft);
|
||||
--surface-3: #303a46;
|
||||
--surface-4: var(--app-border);
|
||||
--text-1: var(--app-text);
|
||||
--text-2: var(--app-text-muted);
|
||||
}
|
||||
|
||||
html[data-theme="light"] {
|
||||
color-scheme: light;
|
||||
--surface-1: #ffffff;
|
||||
--surface-2: #f8fafc;
|
||||
--surface-3: #eef2f7;
|
||||
--surface-4: #cbd5e1;
|
||||
--text-1: #17202a;
|
||||
--text-2: #3d4b5c;
|
||||
--muted-text: #64748b;
|
||||
--app-bg: #f8fafc;
|
||||
--app-panel: #ffffff;
|
||||
--app-panel-soft: #f1f5f9;
|
||||
--app-border: #cbd5e1;
|
||||
--app-text: #17202a;
|
||||
--app-text-muted: #526174;
|
||||
--app-link: #3157d5;
|
||||
--app-accent: #3157d5;
|
||||
--app-focus: #3157d5;
|
||||
--surface-1: var(--app-panel);
|
||||
--surface-2: var(--app-panel-soft);
|
||||
--surface-3: #e2e8f0;
|
||||
--surface-4: var(--app-border);
|
||||
--text-1: var(--app-text);
|
||||
--text-2: var(--app-text-muted);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
html[data-theme="system"] {
|
||||
color-scheme: light;
|
||||
--app-bg: #f8fafc;
|
||||
--app-panel: #ffffff;
|
||||
--app-panel-soft: #f1f5f9;
|
||||
--app-border: #cbd5e1;
|
||||
--app-text: #17202a;
|
||||
--app-text-muted: #526174;
|
||||
--app-link: #3157d5;
|
||||
--app-accent: #3157d5;
|
||||
--app-focus: #3157d5;
|
||||
--surface-1: var(--app-panel);
|
||||
--surface-2: var(--app-panel-soft);
|
||||
--surface-3: #e2e8f0;
|
||||
--surface-4: var(--app-border);
|
||||
--text-1: var(--app-text);
|
||||
--text-2: var(--app-text-muted);
|
||||
}
|
||||
}
|
||||
|
||||
body,
|
||||
.post-card,
|
||||
.editor-form,
|
||||
.login-container,
|
||||
.comments-section,
|
||||
.marker-card,
|
||||
.sharing-panel,
|
||||
.sharing-user,
|
||||
.post,
|
||||
.comment-item,
|
||||
.sidebar .about {
|
||||
background: var(--app-panel) !important;
|
||||
color: var(--app-text) !important;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--gray-0);
|
||||
color: var(--text-1);
|
||||
background: var(--app-bg) !important;
|
||||
}
|
||||
|
||||
.site-header {
|
||||
background: var(--app-panel) !important;
|
||||
border-color: var(--app-border) !important;
|
||||
}
|
||||
|
||||
.site-title a,
|
||||
.site-nav a:hover,
|
||||
.site-nav a.active,
|
||||
a {
|
||||
color: var(--app-link) !important;
|
||||
}
|
||||
|
||||
.site-nav a,
|
||||
.user-menu .username,
|
||||
.post-meta,
|
||||
.post-card-meta,
|
||||
.post-card-excerpt,
|
||||
.marker-date,
|
||||
.marker-coords,
|
||||
.comment-meta,
|
||||
.sharing-help,
|
||||
.empty-share-list,
|
||||
.timeline-event .date {
|
||||
color: var(--app-text-muted) !important;
|
||||
}
|
||||
|
||||
.post-title,
|
||||
.post-card-title a,
|
||||
.chapter-header h3,
|
||||
.login-header h1,
|
||||
label,
|
||||
.marker-header h4,
|
||||
.post h3,
|
||||
.sidebar h3,
|
||||
.chapter-content,
|
||||
.post-description,
|
||||
.comment-text {
|
||||
color: var(--app-text) !important;
|
||||
}
|
||||
|
||||
input,
|
||||
select,
|
||||
textarea,
|
||||
button {
|
||||
color: var(--text-1);
|
||||
textarea {
|
||||
background: var(--app-panel-soft) !important;
|
||||
border-color: var(--app-border) !important;
|
||||
color: var(--app-text) !important;
|
||||
}
|
||||
|
||||
input::placeholder,
|
||||
textarea::placeholder {
|
||||
color: var(--app-text-muted) !important;
|
||||
}
|
||||
|
||||
input[type="file"] {
|
||||
background: var(--surface-2);
|
||||
color: var(--text-1);
|
||||
background: var(--app-panel-soft) !important;
|
||||
color: var(--app-text) !important;
|
||||
}
|
||||
|
||||
input[type="file"]::file-selector-button {
|
||||
border: 1px solid var(--app-border);
|
||||
border-radius: 6px;
|
||||
background: var(--surface-1);
|
||||
color: var(--text-1);
|
||||
background: var(--app-panel);
|
||||
color: var(--app-text);
|
||||
padding: 0.35rem 0.7rem;
|
||||
margin-right: 0.75rem;
|
||||
cursor: pointer;
|
||||
@@ -45,6 +150,11 @@ input[type="file"]::file-selector-button:hover {
|
||||
background: var(--surface-3);
|
||||
}
|
||||
|
||||
.badge {
|
||||
background: color-mix(in srgb, var(--app-accent) 18%, transparent) !important;
|
||||
color: var(--app-text) !important;
|
||||
}
|
||||
|
||||
input:focus,
|
||||
select:focus,
|
||||
textarea:focus {
|
||||
@@ -52,6 +162,38 @@ textarea:focus {
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.theme-switcher {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.theme-switcher label {
|
||||
color: var(--app-text-muted) !important;
|
||||
font-size: 0.85rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.theme-select {
|
||||
width: auto;
|
||||
min-width: 6.5rem;
|
||||
padding: 0.35rem 0.55rem;
|
||||
border-radius: 6px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.theme-switcher-floating {
|
||||
position: fixed;
|
||||
top: 1rem;
|
||||
right: 1rem;
|
||||
z-index: 1200;
|
||||
background: var(--app-panel) !important;
|
||||
border: 1px solid var(--app-border);
|
||||
border-radius: 8px;
|
||||
padding: 0.45rem 0.6rem;
|
||||
box-shadow: var(--shadow-3);
|
||||
}
|
||||
|
||||
/* Mobile-first approach */
|
||||
.map-container {
|
||||
height: 100vh;
|
||||
@@ -76,7 +218,8 @@ textarea:focus {
|
||||
border-left: 3px solid #3498db;
|
||||
padding: 15px 20px;
|
||||
margin: 20px 0;
|
||||
background-color: #f9f9f9;
|
||||
background-color: var(--app-panel-soft);
|
||||
color: var(--app-text);
|
||||
}
|
||||
|
||||
.timeline-event .date {
|
||||
@@ -86,7 +229,7 @@ textarea:focus {
|
||||
|
||||
.timeline-event .location {
|
||||
font-size: 0.9em;
|
||||
color: #2c3e50;
|
||||
color: var(--app-text-muted);
|
||||
}
|
||||
|
||||
.images-container {
|
||||
|
||||
Reference in new issue
Block a user