Template:Icon: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
(add class parameter)
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>[[File:{{trim | {{{1}}} }}|link={{{link|}}}|{{#if: {{{w|}}}{{{h|}}} | {{{w|}}}x{{{h|}}}px | x{{trim | {{{2|40}}} }}px }}|alt={{{caption|{{{link|{{{1}}} }}}}}}|class={{{class|}}}]]<span class="bg3wiki-after-icon"></span></includeonly><noinclude>
<includeonly>[[File:{{trim | {{{1}}} }}|link={{{link|}}}|{{#if: {{{w|}}}{{{h|}}} | {{{w|}}}x{{{h|}}}px | x{{trim | {{{2|40}}} }}px }}|alt={{{caption|{{{link|{{{1}}} }}}}}}|class=bg3wiki-icon {{{class|}}}]]<span class="bg3wiki-after-icon"></span></includeonly><noinclude>
Usage: <pre>{{icon | Flourish Icon.png }}</pre>{{documentation|content=
{{documentation|content=
Usage: <pre>{{icon | Flourish Icon.png }}</pre>


Result: {{icon | Flourish Icon.png }}
Result: {{icon | Flourish Icon.png }}
Line 40: Line 41:
Result: {{icon | Missing Filename 123.png | link = Flourish }}
Result: {{icon | Missing Filename 123.png | link = Flourish }}


Drop shadow: {{icon | Flourish Icon.png | class = bg3wiki-drop-shadow }}
Drop shadow:
<pre>
{{icon | Flourish Icon.png | class = bg3wiki-lightmode-drop-shadow }}
</pre>
 
{{icon | Flourish Icon.png | class = bg3wiki-lightmode-drop-shadow }}
}}
}}
[[Category:Icon Templates]]
[[Category:Icon templates]]
</noinclude>
</noinclude>

Latest revision as of 15:27, 23 June 2024

Template documentation
Usage:
{{icon | Flourish Icon.png }}

Result: Flourish Icon.png

The default size is x40px meaning the icon is scaled until the height is 40 px. It's usually important to limit the height since the icons are used inline, and a very high inline image makes for an unpleasant text layout.

An alternative value for the height can be provided like so:

Usage:
{{icon | Flourish Icon.png | 30 }}

Result: Flourish Icon.png

Usage:
{{icon | Flourish Icon.png | 50 }}

Result: Flourish Icon.png

Alternatively you can use the named parameters w and h. Note that these are max values so the more limiting one applies. In the following example, the height value is essentially ignored because the original image is a square so the width becomes the limiting factor. (Were the original image 200 by 500, the result would be 20 by 50.)

Usage:
{{icon | Flourish Icon.png | w = 20 | h = 50 }}

Result: Flourish Icon.png

You can also provide a link:

Usage:
{{icon | Flourish Icon.png | link = Flourish }}

Result: Flourish

Caption (alt text) will be the link by default but can be changed:

Usage:
{{icon | Flourish Icon.png | link = Flourish | caption = Blah }}

Result: Blah

Behavior when icon is missing:

Usage:
{{icon | Missing Filename 123.png | link = Flourish }}

Result: File:Missing Filename 123.png

Drop shadow:

{{icon | Flourish Icon.png | class = bg3wiki-lightmode-drop-shadow }}

Flourish Icon.png