Skip to content

v2.5.8 - Light/dark mode (admin + mobile)

Choose a tag to compare

@hummelmose hummelmose released this 01 Aug 18:14
· 18 commits to main since this release

WP VisitChart v2.5.8

Light/dark mode support for both the admin dashboard and mobile page.


v2.5.6 — Dark mode

Admin dashboard

  • Moon/sun toggle button in the sticky live bar (right side)
  • Theme preference saved per WordPress user via update_user_meta() and a dedicated AJAX handler with nonce verification — each editor has their own independent preference
  • All colours replaced with CSS custom properties (--ls-bg, --ls-card, --ls-accent etc.) with full light and dark palettes
  • Chart.js colours read from CSS custom properties via getComputedStyle() and update dynamically when the theme is toggled

Mobile page

  • Moon/sun toggle button in the sticky live bar (right side)
  • Theme preference saved in localStorage — persists across visits on the same device
  • All colours replaced with CSS custom properties

v2.5.7 — Fix: dark mode not persisting on admin page reload

document.body is null when an inline <script> runs inside <head>, causing classList.add() to fail silently on every page load — the class was never actually set. Fixed by using document.documentElement (<html>) instead, which is always available regardless of DOM parse state. CSS selectors updated from body.lstats-dark to html.lstats-dark.


v2.5.8 — Fix: white gaps between cards in dark mode

WordPress's own #wpcontent and #wpbody-content backgrounds were showing through the gaps between cards. Fixed by adding background: var(--ls-bg) on those elements when in dark mode, via admin_head inline CSS with !important.


Documentation

Both the English user manual and the Danish user manual have been updated with a new section covering the light/dark mode feature.


Upgrade

Download wp-visitchart.zip below and replace the existing plugin files. No database changes required.