Template:ShowInstrument: Difference between revisions

From PickiPedia: A knowledge base of bluegrass, old time psychedelic jams, and other public domain music
Jump to navigationJump to search
No edit summary
Magent (talk | contribs)
Pick the icon by instrument family, so "5-string banjo" shows a banjo and a cello shows nothing (via update-page on MediaWiki MCP Server)
 
(6 intermediate revisions by 2 users not shown)
Line 13: Line 13:


The first form queries the musician's Primary instrument property. The second form overrides it with the specified instrument.
The first form queries the musician's Primary instrument property. The second form overrides it with the specified instrument.
== Which icon ==
The instrument is written down as it was played — "5-string banjo", "clawhammer banjo", "bass guitar" — and shown that way in the tooltip. [[Module:Instruments]] decides which of the eleven icons stands for it. An instrument with no icon, such as a cello, shows no icon rather than a broken image.
To add an icon, upload <code>File:Instrument-icon-''name''.png</code> and add ''name'' to the module's family list.


== Rotation ==
== Rotation ==
Banjo, guitar, mandolin, and ukulele icons are rotated -30° to look natural at a playing angle. Fiddle, bass, dobro, tin whistle, autoharp, and vocals are displayed upright.
Banjo, guitar, mandolin, and ukulele icons are rotated -30° to look natural at a playing angle. Fiddle, bass, dobro, tin whistle, autoharp, and vocals are displayed upright. This follows the family, so a 5-string banjo tilts like any other banjo.
 
== Styling ==
Icons use <code>line-height:0; vertical-align:baseline</code> so they don't affect text flow. They may slightly overlap adjacent text, which is intentional. The <code>vertical-align:baseline</code> overrides MediaWiki's default <code>vertical-align:middle</code> on images.


== See also ==
== See also ==
* [[Module:Instruments]] - Instrument name to icon
* [[Template:MusicianInfo]] - Sets the '''Primary instrument''' property
* [[Template:MusicianInfo]] - Sets the '''Primary instrument''' property
* [[Template:ThinkingEntityInfo]] - Shows instrument icon in infobox
* [[Template:ThinkingEntityInfo]] - Shows instrument icon in infobox
</noinclude><includeonly>[[{{{1}}}|{{#rambutanplain:{{{1}}}}}]]{{#if:{{{2|}}}|<span title="{{lc:{{{2}}}}}" style="display:inline-block;{{#switch:{{lc:{{{2}}}}}|banjo|guitar|mandolin|ukulele=transform:rotate(-30deg);|}}">[[File:Instrument-icon-{{lc:{{{2}}}}}.png|x20px|{{lc:{{{2}}}}}|link=]]</span>|{{#if:{{#show:{{{1}}}|?Primary instrument|link=none|headers=hide|default=}}|<span title="{{lc:{{#show:{{{1}}}|?Primary instrument|link=none|headers=hide}}}}" style="display:inline-block;line-height:0;vertical-align:baseline;position: relative;top: -4px;left: -2px;width: 9px;{{#switch:{{lc:{{#show:{{{1}}}|?Primary instrument|link=none|headers=hide}}}}|banjo|guitar|mandolin|ukulele=transform:rotate(-30deg);|}}">[[File:Instrument-icon-{{lc:{{#show:{{{1}}}|?Primary instrument|link=none|headers=hide}}}}.png|x18px|{{lc:{{#show:{{{1}}}|?Primary instrument|link=none|headers=hide}}}}|link=]]</span>}}}}</includeonly>
</noinclude><includeonly>[[{{{1}}}|{{#rambutanplain:{{{1}}}}}]]{{#if:{{{2|}}}|{{#invoke:Instruments|badge|1={{{2}}}|size=20}}|{{#invoke:Instruments|badge|1={{#show:{{{1}}}|?Primary instrument|link=none|headers=hide|default=}}|size=18|tuck=1}}}}</includeonly>

Latest revision as of 22:08, 19 September 2026

Inline template for linking to a musician with their instrument icon. Queries the musician's Primary instrument semantic property and displays a small icon with a tooltip.

Usage

{{ShowInstrument|Cory Walker}}

With instrument override:

{{ShowInstrument|Jake Stargel|bass}}

The first form queries the musician's Primary instrument property. The second form overrides it with the specified instrument.

Which icon

The instrument is written down as it was played — "5-string banjo", "clawhammer banjo", "bass guitar" — and shown that way in the tooltip. Module:Instruments decides which of the eleven icons stands for it. An instrument with no icon, such as a cello, shows no icon rather than a broken image.

To add an icon, upload File:Instrument-icon-name.png and add name to the module's family list.

Rotation

Banjo, guitar, mandolin, and ukulele icons are rotated -30° to look natural at a playing angle. Fiddle, bass, dobro, tin whistle, autoharp, and vocals are displayed upright. This follows the family, so a 5-string banjo tilts like any other banjo.

See also