15 lines
896 B
Plaintext
15 lines
896 B
Plaintext
<%#
|
|
Theme switcher: Light / Auto / Dark radiogroup. Zero-JS — the radios drive the
|
|
html:has(#theme-…:checked) token swaps in styles.css, so the ids are a fixed CSS
|
|
contract (one switch per page). Config: value? ∈ light|auto|dark (default auto,
|
|
rendered checked) · label?.
|
|
%><%
|
|
const value = locals.value || "auto";
|
|
const label = locals.label || t("theme.label");
|
|
-%>
|
|
<div class="theme-switch" role="radiogroup" aria-label="<%= label %>">
|
|
<label><input type="radio" name="theme" id="theme-light"<%= value === "light" ? " checked" : "" %>><span><%= t("theme.light") %></span></label>
|
|
<label><input type="radio" name="theme" id="theme-auto"<%= value === "auto" ? " checked" : "" %>><span><%= t("theme.auto") %></span></label>
|
|
<label><input type="radio" name="theme" id="theme-dark"<%= value === "dark" ? " checked" : "" %>><span><%= t("theme.dark") %></span></label>
|
|
</div>
|