Page MenuHomePhabricator

Score should output dark-mode compatible music
Closed, ResolvedPublicBUG REPORT

Description

Score currently outputs an SVG with a white background, even on dark mode. Ideally, two seperate images could be generated (maybe with some code snippets inserted from https://wiki.lilypond.community/wiki/Dark_mode_sheet_music) and we could pick and choose depending on whether it is light or dark mode. Simple skin-invert-image would also invert background colours so that won't work.

Event Timeline

The SVG generated by LilyPond does not have a background. The Score extension wraps the SVG <img> tag in a div with class="mw-ext-score noresize" which is styled to have a white background. All we need to do is remove the white background CSS, and add skin-invert to the div classes, or otherwise tweak the CSS for mw-ext-score to invert the SVG colours. This is well supported by all major browsers, https://caniuse.com/?search=svg

These two screenshots of part of the discussion on Wikipedia show the result of removing the CSS background rule at .mw-ext-score img and adding skin-invert to the containing div, before and after:

Screenshot_20260712_233717.png (1,117×411 px, 142 KB)

Screenshot_20260712_233913.png (1,117×411 px, 142 KB)

Change #1313207 had a related patch set uploaded (by Jonathanischoice; author: Jonathanischoice):

[mediawiki/extensions/Score@master] Tweak SVG output to support dark mode colours, T431148

https://gerrit.wikimedia.org/r/1313207

Change #1313207 had a related patch set uploaded (by Jonathanischoice; author: Jonathanischoice):

[mediawiki/extensions/Score@master] Tweak SVG output to support dark mode colours

https://gerrit.wikimedia.org/r/1313207

This patch preserves current CSS behaviour for PNG output, and uses the dark mode support class when SVG output is enabled.

Change #1313207 merged by jenkins-bot:

[mediawiki/extensions/Score@master] Tweak SVG output to support dark mode colours

https://gerrit.wikimedia.org/r/1313207

TheDJ assigned this task to Jonathanischoice.