Jump to content

Template talk:Multiple image

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia


Dark mode skin invert image problem

[edit]

When using "classX=skin-invert-image" on chemical structure images within multiple image templates to invert them for dark mode, a bug occurs such that the image becomes pure white or near-pure white rather than inverted. Here is an example:

{{Multiple image | align = none | header = Chemical structures of psychedelics | image1 = Psilocybin, Kekulé, skeletal formula of canonical psilocybin.svg | width1 = 225px | class1 = skin-invert-image | caption1 = [[Psilocybin]] | image2 = LSD skeletal formula.svg | width2 = 150px | class2 = skin-invert-image | caption2 = [[LSD]] }}

Which displays as follows:

Chemical structures of psychedelics

It's preventing full dark mode implementation on many pages and should be fixed. – AlyInWikiWonderland (talk, contribs) 22:48, 23 December 2025 (UTC)[reply]

I think the problem is that by default the multiple image template has a background color (white). Moreover, there is no way to remove the background or make it transparent. So it's not possible to fix this issue for now without modifying the template code. To fix this template, I'd suggest having a transparent background by default and only adding a background color when the background color field is used. Or, at the least, adding some way of having a transparent background to the template. Thank you. – AlyInWikiWonderland (talk, contribs) 03:43, 23 February 2026 (UTC)[reply]
example with "thumb"
example with "right", without "thumb"
example with "right", without "thumb"
As can be seen from Special:Diff/1273380762, the template's CSS attempts to avoid this issue. I don't see any suspicious changes in module since the parameters |class1= and |class2= were introduced: Special:Diff/1273382243/1330539349. The corresponding test is at Template:Multiple image/testcases § Test 21 – Dark mode test.
It's possible that something changed in the HTML layout that broke these CSS selectors. For example, the regular File: syntax (see two of File:Example.svg on the right) produces a <figure> tag with the attribute class="mw-default-size skin-invert-image", but the demo of {{Multiple image}} above produces a <span class="skin-invert-image" ...>.
User:Arthurfragoso, perhaps you could take a look at what's going on with dark mode support here? —⁠andrybak (talk) 22:53, 23 February 2026 (UTC)[reply]
Oh, I didn't realize that Arthurfragoso hasn't been active in several months. Posted a notification at WP:VPT instead. —⁠andrybak (talk) 23:03, 23 February 2026 (UTC)[reply]
@AlyInWikiWonderland FWIW |image_style=background-color:inherit seems to work around it, but that is obviously a temporary solution. ~ oklopfer (💬) 01:32, 24 March 2026 (UTC)[reply]

@Andrybak and AlyInWikiWonderland: I got it all working after spending an unhealthy amount of time on it (note that me adding the sandbox example here overrides the css of the one above):

{{Multiple image/sandbox | align = center | header = Chemical structures of psychedelics | image1 =Psilocybin, Kekulé, skeletal formula of canonical psilocybin.svg | width1 = 225px | class1 = skin-invert-image |caption1 = [[Psilocybin]] | image2 = Psilocybin_zwitterion_3D_ball.png | width2 = 150px | class2 = bg-transparent |caption2 = Psilocybin in 3D }}
Chemical structures of psychedelics
Psilocybin in 3D

The problem lies in the .thumbimage class, which was forcing a white background at a higher level even though the images lower down were not having it set. |image_style=background-color: overrides that value, but it is the ultimate reason why image backgrounds default to white, regardless of skin mode.

Here is the diff that is required to be applied to the style sheet (i.e. replace Template:Multiple image/styles.css L76-L85 with Template:Multiple_image/sandbox/styles.css L87-L115; L75-L86 in the sandbox should only be needed for Template:Multiple_image/testcases):

@media screen { html.skin-theme-clientpref-night .multiimageinner span:not(.skin-invert-image):not(.skin-invert):not(.bg-transparent) img { background-color: white; } } @media screen and (prefers-color-scheme: dark) { html.skin-theme-clientpref-os .multiimageinner span:not(.skin-invert-image):not(.skin-invert):not(.bg-transparent) img { background-color: white; } }
+
@media screen { .multiimageinner .thumbimage { background-color: inherit; } html.skin-theme-clientpref-night .multiimageinner .thumbimage:not([style*="background-color"]) span:not(.skin-invert-image):not(.skin-invert):not(.bg-transparent) img, html.skin-theme-clientpref-day .multiimageinner .thumbimage:not([style*="background-color"]) span:not(.bg-transparent) img { background-color: white; } } @media screen and (prefers-color-scheme: dark) { html.skin-theme-clientpref-os .multiimageinner .thumbimage:not([style*="background-color"]) span:not(.skin-invert-image):not(.skin-invert):not(.bg-transparent) img { background-color: white; } }

If we want the backgrounds of the ones without |class=bg-transparent to be black like File: ... |thumb, I could do that too, but this matches how they appear in infoboxes. |image_style=background-color: continues to work as intended, even in combination with skinverts. This also allows |class=bg-transparent to work correctly in light mode. ~ oklopfer (💬) 07:54, 24 March 2026 (UTC)[reply]

As the second example on Template:Multiple image/testcases#Test 21 – Dark mode test shows, we may also need to set header text color… ~ oklopfer (💬) 09:59, 24 March 2026 (UTC)[reply]
Fixed that too, with new parameters: https://en.wikipedia.org/w/index.php?title=Special%3AComparePages&page1=Module%3AMultiple+image&page2=Module%3AMultiple+image%2Fsandbox
Can be applied with |text_color, alias |color.
|background color also now has aliases |background_color (i.e. with proper formatting) and |bg_color. The former (with the space rather than underscore) should be considered deprecated and cleaned up wherever it appears IMO.
Also fixed the issue of the background color bleeding all the way across the page instead of just applying to the box.
All can be seen in the testcases. ~ oklopfer (💬) 15:54, 24 March 2026 (UTC)[reply]
That's great work, thank you Oklopfer! – AlyInWikiWonderland (talk, contribs) 01:26, 25 March 2026 (UTC)[reply]

Parameter not in template

[edit]
Yellow card
Red card
Yellow is 100×50px. Red – 40×120px. |total_width=220 —⁠andrybak (talk) 22:44, 31 January 2026 (UTC)[reply]

The "height" parameter is listed on the page but on the template. Cheeky91021 (talk) 22:05, 31 January 2026 (UTC)[reply]

Here's an example of the template with parameters for both height and width. Note that a value for the parameter |total_width= is required. —⁠andrybak (talk) 22:44, 31 January 2026 (UTC)[reply]
Thanks. Cheeky91021 (talk) 02:30, 4 February 2026 (UTC)[reply]
[edit]

I noticed images wrapping to new lines with this template when on mobile. Setting total_width to 360 (or 365) made it display as anticipated. Maybe this should be suggested somewhere; I changed one example width in the documentation from 400 to 360 in case it helps in other places and thought I'd also draw attention to it here. Chchowmein (talk) 23:58, 17 March 2026 (UTC)[reply]

Which is why they need to add proportional widths for this using the upright= parameter. Fyunck(click) (talk) 04:16, 18 March 2026 (UTC)[reply]

Edit request 25 March 2026

[edit]

Description of suggested change: Multiple updates; the primary purpose of these changes is to fix dark mode implementation, and as a secondary, fixing background color implementation. I have split this into two sections for the two components that need updating.

styles.css

[edit]

Module

[edit]

In conclusion

[edit]

With all of these changes combined, the template finally handles dark mode and background colors correctly. Thank you! ~ oklopfer (💬) 14:56, 25 March 2026 (UTC)[reply]

Please don't paste code blobs into talk pages, they are difficult to follow and impossible to test. The style sheet has a sandbox at Template:Multiple image/sandbox/styles.css: please use that instead. See WP:TESTCASES. --Redrose64 🌹 (talk) 07:03, 26 March 2026 (UTC)[reply]
@Redrose64 it's been in the sandbox too, and with numerous test cases on the page, as I explicitly mentioned here. I wouldn't have made the request if I had not already rigorously tested there. I just used the edit request template, which prompted me to enter the diff. I don't really appreciate the suggested incompetence if you aren't going to check that it had already been done.
anyways, the diff that is required to be applied to the style sheet is replacing Template:Multiple image/styles.css L76-L85 with Template:Multiple_image/sandbox/styles.css L87-L115 (L75-L86 in the sandbox was only needed for /testcases and does not need to be imported) ~ oklopfer (💬) 07:20, 26 March 2026 (UTC)[reply]
 Done already. Santiago Claudio (talk) 08:25, 18 April 2026 (UTC)[reply]
@Santiago Claudio it appears only half was done, for the stylesheet but not for the module. ~ oklopfer (💬) 21:11, 18 April 2026 (UTC)[reply]
 Done with the module. Santiago Claudio (talk) 00:16, 20 April 2026 (UTC)[reply]
@Santiago Claudio Thank you! Though it should be noted that one line was missed:
pargs['thumbtime' .. i], pargs['caption' .. i], pargs['class' .. i], capalign, imgstyle, border))
+
pargs['thumbtime' .. i], pargs['caption' .. i], pargs['class' .. i], capalign, imgstyle, border, tc))
This fixes caption text. I am going to re-open one more time until that one is resolved. ~ oklopfer (💬) 01:54, 20 April 2026 (UTC)[reply]
checkYYour request has been completed. Santiago Claudio (talk) 07:08, 20 April 2026 (UTC)[reply]
@Santiago Claudio many thanks for your assistance and patience! Be well, ~ oklopfer (💬) 07:23, 20 April 2026 (UTC)[reply]

Edit request 16 April 2026

[edit]

Description of suggested change:

I would like to suggest a total_height parameter be added to the template. It would allow for some templates to more properly align with all page elements without compromising images.

Pietrus1 (talk) 00:49, 16 April 2026 (UTC)[reply]

 Not done: please make your requested changes to the template's sandbox first. See WP:TESTCASES. – Jonesey95 (talk) 04:46, 17 April 2026 (UTC)[reply]

Edit request

[edit]

Can we give this an option to reflect the user's preferences? If the size is less than, say, n = 10, could we engineer it so that this is equivalent to "upright=n"? We could then set the size to 1 to fit most other images in the article. — kwami (talk) 20:32, 16 May 2026 (UTC)[reply]

Logged-out appearance

[edit]

Currently, it appears that the default |background_color= and |align= parameters are not being applied when logged out. Chchowmein (talk) 18:29, 21 May 2026 (UTC)[reply]

@Chchowmein what platform and browser are you having this issue on? I am not able to reproduce it. ~ oklopfer (💬) 20:04, 21 May 2026 (UTC)[reply]
Actually, partially scratch that. I am noticing the issue you described occurs when editing a page, but not when regularly viewing the page, even when logged in. ~ oklopfer (💬) 20:16, 21 May 2026 (UTC)[reply]
I've just be driving myself crazy wondering why this wasn't aligning correctly in preview. It doesn't work correctly having saves the edit. Is this a WP:ITSTHURSDAY thing? -- LCU ActivelyDisinterested «@» °∆t° 16:07, 22 May 2026 (UTC)[reply]
I've posted notice of this to WP:VPT. -- LCU ActivelyDisinterested «@» °∆t° 16:11, 22 May 2026 (UTC)[reply]
In your preferences, is the setting "Show preview without reloading the page" on? Ponor (talk) 23:01, 30 May 2026 (UTC)[reply]

Add tracking category when no images are being used

[edit]

While noticing a bot removing the last image from a template usage, I noticed that there is no indication that the template is now useless on that page. Could a tracking category be added if there are no images being used? Gonnym (talk) 06:23, 28 May 2026 (UTC)[reply]

Visual editor not displaying correctly

[edit]

When the alignment is not set to none, it displays in the visual editor as if it were anyhow. Or at least that's the case for me in Vector 2022. JacobTheRox(talk | contributions) 11:07, 31 May 2026 (UTC)[reply]

Please link to a page where this is happening. The template's /testcases page could be a good place to demonstrate the problem. – Jonesey95 (talk) 00:35, 3 June 2026 (UTC)[reply]