fix: theme toggle now properly handles auto mode
Remove data-theme attribute when mode="auto" instead of setting it to "auto". Pico's OS-dark selector is :root:not([data-theme]), so any value (even "auto") prevents dark-mode Pico styles. Add Pico form element background vars and color-scheme: light to match active theme. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
+15
-1
@@ -8,7 +8,9 @@
|
||||
|
||||
Theme selectors mirror Pico's own so equal specificity + later source order
|
||||
wins: light = :root:not([data-theme=dark]) ; dark = the two dark selectors.
|
||||
`data-theme="auto"` is not `light`, so it follows the OS preference.
|
||||
The "system" state renders with **no** data-theme attribute (base.html
|
||||
removes it) — Pico's OS-dark block is `:root:not([data-theme])`, so a literal
|
||||
data-theme="auto" would keep Pico light while this file went dark.
|
||||
========================================================================== */
|
||||
|
||||
/* --- Tokens: light (paper) ----------------------------------------------- */
|
||||
@@ -73,9 +75,15 @@
|
||||
--pico-form-element-placeholder-color: var(--im-text-faint);
|
||||
--pico-form-element-active-border-color: var(--im-accent);
|
||||
--pico-form-element-focus-color: var(--im-accent);
|
||||
/* Pico swaps the *background* on :focus/:active. Remap it too, or a focused
|
||||
field falls back to Pico's own palette instead of ours. */
|
||||
--pico-form-element-active-background-color: var(--im-surface);
|
||||
--pico-form-element-selected-background-color: var(--im-surface-3);
|
||||
--pico-code-background-color: var(--im-surface-3);
|
||||
--pico-code-color: var(--im-text);
|
||||
--pico-modal-overlay-background-color: rgba(24, 30, 36, .42);
|
||||
/* Native widgets: <select> popup, scrollbars, autofill. */
|
||||
color-scheme: light;
|
||||
}
|
||||
|
||||
/* --- Tokens: dark (ink) -------------------------------------------------- */
|
||||
@@ -140,9 +148,12 @@
|
||||
--pico-form-element-placeholder-color: var(--im-text-faint);
|
||||
--pico-form-element-active-border-color: var(--im-accent);
|
||||
--pico-form-element-focus-color: var(--im-accent);
|
||||
--pico-form-element-active-background-color: var(--im-surface-3);
|
||||
--pico-form-element-selected-background-color: var(--im-surface-3);
|
||||
--pico-code-background-color: var(--im-surface-3);
|
||||
--pico-code-color: var(--im-text);
|
||||
--pico-modal-overlay-background-color: rgba(4, 8, 11, .62);
|
||||
color-scheme: dark;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,9 +217,12 @@
|
||||
--pico-form-element-placeholder-color: var(--im-text-faint);
|
||||
--pico-form-element-active-border-color: var(--im-accent);
|
||||
--pico-form-element-focus-color: var(--im-accent);
|
||||
--pico-form-element-active-background-color: var(--im-surface-3);
|
||||
--pico-form-element-selected-background-color: var(--im-surface-3);
|
||||
--pico-code-background-color: var(--im-surface-3);
|
||||
--pico-code-color: var(--im-text);
|
||||
--pico-modal-overlay-background-color: rgba(4, 8, 11, .62);
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
/* --- Typography + global rhythm ----------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user