Skip to content

web: Add dark mode support to web UI - #7121

Open
matlads wants to merge 3 commits into
beetbox:masterfrom
matlads:add-web-dark-mode
Open

matlads wants to merge 3 commits into
beetbox:masterfrom
matlads:add-web-dark-mode

Conversation

@matlads

@matlads matlads commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds dark mode to the beets web UI, with a header button to choose the color
scheme: auto (follows the OS/browser preference), light, or dark. The choice is
remembered in localStorage.

Changes

  • Dark page background and text, sidebar, selected-row highlight, query input,
    link color and disabled player button (beetsplug/web/static/beets.css).
  • A header button that cycles auto/light/dark, persists the choice in
    localStorage, and reacts to live OS theme changes while in auto
    (beetsplug/web/static/beets.js, beetsplug/web/templates/index.html).
  • Dark styles are selected through a data-theme attribute on <html> rather
    than a prefers-color-scheme media query, so the button can override the OS
    preference. An inline script applies the saved theme before first paint to
    avoid a flash.
  • Documentation (docs/plugins/web.rst) and changelog entry.
  • A test asserting the toggle is rendered on the index page.

Testing

  • pytest test/plugins/test_web.py — 46 passed.
  • ruff check, ruff format --check, docstrfmt, sphinx-lint — clean.
  • Manual: the button cycles auto/light/dark, the choice survives a reload, and
    auto follows OS theme changes.
beet-web-light-mode-2 beet-web-dark-mode-2

@matlads
matlads requested a review from a team as a code owner October 29, 2026 04:07
@matlads matlads changed the title Add dark mode support to web UI web: Add dark mode support to web UI Oct 29, 2026
@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.93%. Comparing base (61ae14e) to head (586a7d5).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7121   +/-   ##
=======================================
  Coverage   80.93%   80.93%           
=======================================
  Files         150      150           
  Lines       21257    21257           
  Branches     3246     3246           
=======================================
  Hits        17205    17205           
  Misses       3244     3244           
  Partials      808      808           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@snejus

snejus commented Nov 1, 2026

Copy link
Copy Markdown
Member

Is it possible to somehow add a button that triggers the colorscheme?

Add a header button that cycles the color scheme through auto, light and dark. The choice is stored in localStorage; "auto" follows the OS preference and reacts to live changes.

Dark styles are now selected via a data-theme attribute on <html> instead of a prefers-color-scheme media query, and an inline script applies the saved theme before first paint to avoid a flash.
@matlads

matlads commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Added the color scheme button requested in the review: it cycles auto → light → dark, defaults to auto (following the OS preference), persists the choice in localStorage, and follows live OS changes while in auto. Also added documentation, a changelog entry, and a test. Ready for another look.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants