Icon button that toggles between dark and light mode.
The flip itself (DOM attribute + localStorage) lives in theme.ts, shared
with the command palette's toggle-theme action, so the two can't drift.
This component only tracks the current value for its icon, seeded from
the DOM on mount and resynced whenever theme.ts reports a change —
including one triggered elsewhere, such as from the palette.
Returns Element
Remarks
main.tsx runs the same dark-first bootstrap logic before React
mounts, so the page paints in the persisted theme without a flash; keep
the two in sync.
Icon button that toggles between dark and light mode.
The flip itself (DOM attribute + localStorage) lives in
theme.ts, shared with the command palette'stoggle-themeaction, so the two can't drift. This component only tracks the current value for its icon, seeded from the DOM on mount and resynced whenevertheme.tsreports a change — including one triggered elsewhere, such as from the palette.