Apply the real brand logo and add a light/dark theme toggle
Replaces the generic placeholder PWA icons and plain "Evection" text in
the sidebar with the actual logo kit (static/img/brand-full-{dark,light}
.png — the icon+wordmark lockup, swapped by theme via CSS). The PWA icon
set (icon-192, icon-512, maskable, apple-touch-icon) is regenerated from
the icon artwork: cropped to its content bounding box, padded to a square,
and flattened onto a solid brand-navy (#0f2038) background — maskable
specifically uses a tighter ~62% safe-zone scale so OS masking never clips
the art. manifest.webmanifest and the theme-color meta now use that same
navy instead of the old placeholder #111111.
Refined the light/dark CSS palette (static/css/base.css) using colors
sampled directly from the logo: brand navy for light-mode text, a blue
pulled from the orbit ring for --accent, amber for --star (already close
to brand, left mostly as-is). Dark mode shifted from a neutral charcoal
background toward the same navy family for consistency with the mark.
Added an explicit Light/Dark/System toggle in the sidebar footer, on top
of the existing prefers-color-scheme support rather than replacing it:
static/js/theme-init.js runs undeferred in <head> (before first paint, to
avoid a flash of the wrong theme) and applies any saved localStorage
choice via a data-theme attribute; static/js/theme.js (deferred) wires the
three buttons. CSS resolves theme in this priority: explicit
[data-theme] attribute, else prefers-color-scheme, else dark (the
unconditional :root default). Both scripts are external files/CSP-safe —
verified no inline <script> crept in and the CSP header is still present
under config.settings.prod.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
No files matched your search
@@ -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;
|
||||
|
||||
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 35 KiB |
@@ -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);
|
||||
})();
|
||||
@@ -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();
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 49 KiB |
@@ -7,9 +7,10 @@
|
||||
<title>{% block title %}Evection{% endblock %}</title>
|
||||
<link rel="stylesheet" href="{% static 'css/base.css' %}">
|
||||
<script src="{% static 'js/htmx.min.js' %}" defer></script>
|
||||
<script src="{% static 'js/theme-init.js' %}"></script>
|
||||
|
||||
<link rel="manifest" href="{% url 'pwa:manifest' %}">
|
||||
<meta name="theme-color" content="#111111">
|
||||
<meta name="theme-color" content="#0f2038">
|
||||
<link rel="icon" href="{% static 'pwa/icons/icon-192.png' %}">
|
||||
<link rel="apple-touch-icon" href="{% static 'pwa/icons/apple-touch-icon.png' %}">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
@@ -46,6 +47,7 @@
|
||||
{% endif %}
|
||||
|
||||
<script src="{% static 'js/stream.js' %}" defer></script>
|
||||
{% if user.is_authenticated %}<script src="{% static 'js/theme.js' %}" defer></script>{% endif %}
|
||||
<script src="{% static 'js/register-sw.js' %}" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,10 @@
|
||||
{% load static %}
|
||||
<nav class="sidebar" aria-label="Feeds and tags">
|
||||
<div class="sidebar-brand">
|
||||
<a href="{% url 'reader:stream' %}">Evection</a>
|
||||
<a href="{% url 'reader:stream' %}" aria-label="Evection">
|
||||
<img src="{% static 'img/brand-full-dark.png' %}" alt="Evection" class="brand-wordmark-dark">
|
||||
<img src="{% static 'img/brand-full-light.png' %}" alt="Evection" class="brand-wordmark-light">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<a href="{% url 'feeds:subscription_list' %}" class="sidebar-manage-btn">Subscription management</a>
|
||||
@@ -73,4 +77,10 @@
|
||||
{% if request.user.is_staff %}<li><a href="{% url 'core:dashboard' %}">Dashboard</a></li>{% endif %}
|
||||
<li><a href="{% url 'accounts:logout' %}">Log out</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="theme-switcher" role="group" aria-label="Theme">
|
||||
<button type="button" data-theme-choice="light">Light</button>
|
||||
<button type="button" data-theme-choice="dark">Dark</button>
|
||||
<button type="button" data-theme-choice="system">System</button>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -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": [
|
||||
{
|
||||
|
||||