Module:Swatches/doc
This is the documentation page for Module:Swatches
Module:Swatches
Lists cosmetic swatches from Module:Swatches/data as infoboxes.
This module outputs its content inside a collapsible container, which is collapsed by default (mw-collapsible mw-collapsed).
When expanded, the swatch infobox cards are laid out using an inner flex container configured for responsive wrapping and horizontal overflow (display:flex; flex-wrap:wrap; overflow-x:auto; align-items:flex-start; gap:1em;).
Usage
List all swatches
If no scope is provided, all swatches in the dataset are shown:
{{#invoke:Swatches|list}}
List swatches for a scope page
Scope can be specified to show all swatches that are compatible with at least one class in that scope:
{{#invoke:Swatches|list|<SCOPE>}}
List swatches for a class page
Class can additionally be specified to show only swatches that are compatible with that class:
{{#invoke:Swatches|list|<SCOPE>|<CLASS>}}
Render swatches expanded
By default, the swatch list is collapsed. To render it expanded, pass a truthy value to the expanded parameter.
{{#invoke:Swatches|list|expanded=yes}}
Parameters
- 1 (optional)
- string
- Compatibility scope to filter swatches.
- If omitted, all swatches are shown.
- If an invalid value is specified, no swatches are shown.
- Valid values (case-insensitive, singular or plural):
- •
Vehicle - •
Weapon - •
Garment - •
Placeable
- •
- 2 (optional)
- string
- Name of a class within the specified scope, to further filter swatch compatibility.
{{PAGENAME}}can be used if the page title matches the dataset naming.- Examples (case-insensitive):
- •
Sandbike - •
Flamethrowers - •
Heavy Armor
- •
- expanded (optional)
- boolean
- If specified with a truthy value, output will be expanded by default.
- Valid values:
- •
true - •
yes - •
1
- •
Notes
- Swatch compatibility rules are defined in Module:Swatches/data using the optional
scopesandonlyClassesfields. classis matched case-insensitively against class names withinonlyClassestokens in Module:Swatches/data.