diff --git a/static/css/base.css b/static/css/base.css index 1a28f07..0a0e75d 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -1,37 +1,58 @@ +/* Brand palette, sampled from the logo (see static/img/): deep navy + wordmark, amber/orange RSS icon, sky-blue orbit ring. Dark is the + default; light applies either by OS preference (prefers-color-scheme) + or by explicit choice (html[data-theme], set by static/js/theme.js) — + an explicit choice always wins over the OS preference. */ + :root { color-scheme: dark; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; - --bg: #17181c; - --bg-sidebar: #1b1c21; - --bg-row-hover: #24262c; + --bg: #0c0f16; + --bg-sidebar: #11151e; + --bg-row-hover: #1a202e; --bg-row-selected: #1d3252; - --accent: #3b82f6; - --accent-dark: #1d4ed8; + --accent: #5b93d9; + --accent-dark: #3f72b8; --star: #f5b400; --text: #e8e8ea; --text-muted: #a3a3a8; --text-dim: #74747a; - --border: #2a2b31; + --border: #242a38; } @media (prefers-color-scheme: light) { - :root { + :root:not([data-theme]) { color-scheme: light; --bg: #ffffff; - --bg-sidebar: #f4f5f7; - --bg-row-hover: #eef0f3; + --bg-sidebar: #f4f6fa; + --bg-row-hover: #eef1f6; --bg-row-selected: #e4edfd; - --accent: #1a56db; - --accent-dark: #163f99; + --accent: #2f5fa8; + --accent-dark: #24497f; --star: #b7790f; - --text: #1a1b1e; - --text-muted: #5b5c63; - --text-dim: #85868c; - --border: #e2e3e7; + --text: #0f2038; + --text-muted: #4a5568; + --text-dim: #7c8798; + --border: #e2e6ed; } } +:root[data-theme="light"] { + color-scheme: light; + --bg: #ffffff; + --bg-sidebar: #f4f6fa; + --bg-row-hover: #eef1f6; + --bg-row-selected: #e4edfd; + --accent: #2f5fa8; + --accent-dark: #24497f; + --star: #b7790f; + --text: #0f2038; + --text-muted: #4a5568; + --text-dim: #7c8798; + --border: #e2e6ed; +} + * { box-sizing: border-box; } @@ -124,17 +145,74 @@ form p { } .sidebar-brand { - padding: 0.9rem 1rem; - font-weight: 600; - font-size: 1.1rem; + padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); + display: flex; + justify-content: center; } .sidebar-brand a { + display: block; color: var(--text); text-decoration: none; } +.sidebar-brand img { + display: block; + height: 64px; + width: auto; + margin: 0 auto; +} + +.brand-wordmark-light { + display: none; +} + +@media (prefers-color-scheme: light) { + :root:not([data-theme]) .brand-wordmark-dark { + display: none; + } + :root:not([data-theme]) .brand-wordmark-light { + display: block; + } +} + +:root[data-theme="light"] .brand-wordmark-dark { + display: none; +} + +:root[data-theme="light"] .brand-wordmark-light { + display: block; +} + +.theme-switcher { + display: flex; + gap: 0.25rem; + padding: 0.5rem; +} + +.theme-switcher button { + flex: 1; + background: none; + border: 1px solid var(--border); + color: var(--text-muted); + border-radius: 0.375rem; + font-size: 0.75rem; + padding: 0.3rem 0; +} + +.theme-switcher button:hover { + background: var(--bg-row-hover); + color: var(--text); +} + +.theme-switcher button.active { + background: var(--bg-row-selected); + border-color: var(--accent); + color: var(--text); + font-weight: 600; +} + .sidebar-manage-btn { display: block; margin: 0.75rem 1rem; diff --git a/static/img/brand-full-dark.png b/static/img/brand-full-dark.png new file mode 100644 index 0000000..7788c79 Binary files /dev/null and b/static/img/brand-full-dark.png differ diff --git a/static/img/brand-full-light.png b/static/img/brand-full-light.png new file mode 100644 index 0000000..1aad0f6 Binary files /dev/null and b/static/img/brand-full-light.png differ diff --git a/static/js/theme-init.js b/static/js/theme-init.js new file mode 100644 index 0000000..867142a --- /dev/null +++ b/static/js/theme-init.js @@ -0,0 +1,30 @@ +(function () { + function applyTheme(value) { + if (value === "light" || value === "dark") { + document.documentElement.setAttribute("data-theme", value); + } else { + document.documentElement.removeAttribute("data-theme"); + } + } + + window.setEvectionTheme = function (value) { + try { + if (value === "light" || value === "dark") { + localStorage.setItem("evection-theme", value); + } else { + localStorage.removeItem("evection-theme"); + } + } catch (e) { + /* localStorage unavailable (private mode, etc.) — theme just won't persist */ + } + applyTheme(value); + }; + + var saved = null; + try { + saved = localStorage.getItem("evection-theme"); + } catch (e) { + /* ignore */ + } + applyTheme(saved); +})(); diff --git a/static/js/theme.js b/static/js/theme.js new file mode 100644 index 0000000..c27e180 --- /dev/null +++ b/static/js/theme.js @@ -0,0 +1,21 @@ +document.querySelectorAll(".theme-switcher [data-theme-choice]").forEach(function (button) { + button.addEventListener("click", function () { + window.setEvectionTheme(button.dataset.themeChoice === "system" ? null : button.dataset.themeChoice); + markActiveThemeButton(); + }); +}); + +function markActiveThemeButton() { + var current = null; + try { + current = localStorage.getItem("evection-theme"); + } catch (e) { + /* ignore */ + } + document.querySelectorAll(".theme-switcher [data-theme-choice]").forEach(function (button) { + var isActive = button.dataset.themeChoice === (current || "system"); + button.classList.toggle("active", isActive); + }); +} + +markActiveThemeButton(); diff --git a/static/pwa/icons/apple-touch-icon.png b/static/pwa/icons/apple-touch-icon.png index f1ae00e..b8db277 100644 Binary files a/static/pwa/icons/apple-touch-icon.png and b/static/pwa/icons/apple-touch-icon.png differ diff --git a/static/pwa/icons/icon-192.png b/static/pwa/icons/icon-192.png index 1d026ed..bce2ac5 100644 Binary files a/static/pwa/icons/icon-192.png and b/static/pwa/icons/icon-192.png differ diff --git a/static/pwa/icons/icon-512.png b/static/pwa/icons/icon-512.png index 4311cbb..59a4779 100644 Binary files a/static/pwa/icons/icon-512.png and b/static/pwa/icons/icon-512.png differ diff --git a/static/pwa/icons/icon-maskable.png b/static/pwa/icons/icon-maskable.png index 699c8f7..2e0ca7e 100644 Binary files a/static/pwa/icons/icon-maskable.png and b/static/pwa/icons/icon-maskable.png differ diff --git a/templates/base.html b/templates/base.html index 88e2b34..48ecd87 100644 --- a/templates/base.html +++ b/templates/base.html @@ -7,9 +7,10 @@ {% block title %}Evection{% endblock %} + - + @@ -46,6 +47,7 @@ {% endif %} + {% if user.is_authenticated %}{% endif %} diff --git a/templates/core/_sidebar.html b/templates/core/_sidebar.html index 8251aa9..2659a70 100644 --- a/templates/core/_sidebar.html +++ b/templates/core/_sidebar.html @@ -1,6 +1,10 @@ +{% load static %} diff --git a/templates/pwa/manifest.webmanifest b/templates/pwa/manifest.webmanifest index 44376ea..4a3f1b9 100644 --- a/templates/pwa/manifest.webmanifest +++ b/templates/pwa/manifest.webmanifest @@ -5,8 +5,8 @@ "start_url": "{% url 'reader:stream' %}", "scope": "/", "display": "standalone", - "background_color": "#111111", - "theme_color": "#111111", + "background_color": "#0c0f16", + "theme_color": "#0f2038", "orientation": "portrait-primary", "icons": [ {