mirror of
https://github.com/we-promise/sure.git
synced 2026-05-24 13:04:56 +00:00
`theme_controller#setTheme` already toggles `data-theme` on the
document element, but D3/SVG/canvas consumers that bake color into
attributes (`fill`, `stroke`, `stop-color`) can't observe a CSS
variable change — they need an imperative re-render hook.
Dispatch a `theme:change` CustomEvent on the document element after
the attribute flips, with `detail: { theme: "dark" | "light" }`.
Consumers subscribe via standard connect/disconnect listeners.
Refactor the if/else into a single path while at it — same behavior,
half the lines.
Closes #1764.