User:Zackmann08/color
From Wikipedia, the free encyclopedia
Inherit header color
Alan Dillon | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| Personal details | |||||||||
| Born | 28 September 1982 Castlebar, County Mayo, Ireland | ||||||||
| Gaelic games career | |||||||||
| Height | 1.81 m (5 ft 11 in) | ||||||||
| Sport | Gaelic football | ||||||||
| |||||||||
In the sample at right, I've got {{Infobox Gaelic games biography}} embeded in {{Infobox officeholder}}. Is there some bit of code I can use to get the embeded infobox to inherit the header color from the parent? I.E. make it so these two have the same colors when they are embeded or is this a limitation of Module:Infobox? --Zackmann (Talk to me/What I been doing) 18:06, 8 October 2025 (UTC)
- Through no intention on my part, this should be possible by moving the module you're embedding, and the template containing the embedded template, to TemplateStyles. Izno (talk) 19:08, 8 October 2025 (UTC)
- @Izno: can you give me a little more or link me to an example/documentation? When you say move it to TemplateStyles, what does that mean/look like? Zackmann (Talk to me/What I been doing) 19:13, 8 October 2025 (UTC)
- It's currently not documented for infoboxes, but I did some job of documentation in the context of Template:Sidebar. Basically, infoboxes and sidebars (navboxes too, and more amboxes for certain reasons but these should least be used to attempt to maintain a standard appearance) take a
|templatestyles=parameter that you can use (in the same way you would use atemplatestylestag'ssrcattribute). There are some pre-established general classes corresponding to parameter names e.g.infobox-header, and for any others you add some classes in the infobox definition template page. Then you put the styles associated to relevant classes on the TemplateStyles page, prefixed with the class you assign to the infobox in whole in its|bodyclass=or equivalent. - In this case, the parent I would give the class
ib-officeholder, the moduleib-gaelic-games-bio, then I would add colors in their respective TemplateStyles sheets with.ib-officeholder .infobox-header { background-color: foo; }and.ib-gaelic-games-bio .infobox-header { background-color: bar; }. And that should be it, per the below first paragraph. Izno (talk) 19:20, 8 October 2025 (UTC)
- It's currently not documented for infoboxes, but I did some job of documentation in the context of Template:Sidebar. Basically, infoboxes and sidebars (navboxes too, and more amboxes for certain reasons but these should least be used to attempt to maintain a standard appearance) take a
- @Izno: can you give me a little more or link me to an example/documentation? When you say move it to TemplateStyles, what does that mean/look like? Zackmann (Talk to me/What I been doing) 19:13, 8 October 2025 (UTC)
- And I say through no intention on my part, because what Module:Infobox seems to do today is absorb modules directly into the table presented (rather than create subboxes). Or at least, it does so for other Module:Infobox infoboxes. This causes some information from the embedded module to be lost somehow, among other items its TemplateStyles output.
- IDK if this behavior will survive. If it is desirable generally (this is not the first time I've heard this request), and I think it probably is, it's something that embedded modules can be adjusted into the arbitrary future to do. Izno (talk) 19:14, 8 October 2025 (UTC)
- The issue with just always doing it is that TemplateStyles will have both the overrides for the generic parameters as well as template-specific styles necessary, so that issue is something to think about. Izno (talk) 19:26, 8 October 2025 (UTC)