Template:IconCreate: Difference between revisions
No edit summary |
SlyAceZeta (talk | contribs) m (70 revisions imported: importing from Below Zero wiki) |
||
(20 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<onlyinclude><div style="position:relative; box-sizing:border-box; width:100%; height:{{{height|{{{width|128}}}}}}px;"> |
<onlyinclude><div style="position:relative; box-sizing:border-box; width:100%; height:{{{height|{{{width|128}}}}}}px;"> |
||
<!-- Background Icon --> |
<!-- Background Icon --> |
||
{{#ifeq:{{{bg|}}}|none||<div style="position:absolute; left: calc( (100% - {{{width|128}}}px) / 2 );">[[File:{{#switch:{{{bg|normal}}}|normal=1x1 default bg|plant=1x1 aquatic plant bg|1x1 plant=1x1 aquatic plant bg|2x2 plant=2x2 aquatic plant bg|green=1x1 land plant bg|1x1 green=1x1 land plant bg|2x2 green=2x2 land plant bg|2x2=2x2 default bg|3x3=3x3 default bg|3x2=3x2 default bg|2x3=2x3 default bg|4x4=4x4 default bg|1x2=1x2 default bg|1x2 green=1x2 land plant bg}}.png|{{{width|128}}}px|link={{{link|{{{icon|}}}}}}]]</div>}} |
{{#ifeq:{{{bg|}}}|none||<div style="position:absolute; left: calc( (100% - {{{width|128}}}px) / 2 );">[[File:{{#switch:{{{bg|normal}}}|normal=1x1 default bg|plant=1x1 aquatic plant bg|1x1 plant=1x1 aquatic plant bg|1x2 plant = 1x2 aquatic plant bg|2x2 plant=2x2 aquatic plant bg|green=1x1 land plant bg|1x1 green=1x1 land plant bg|2x2 green=2x2 land plant bg|2x2=2x2 default bg|3x3=3x3 default bg|3x2=3x2 default bg|2x3=2x3 default bg|4x4=4x4 default bg|1x2=1x2 default bg|1x2 green=1x2 land plant bg|purple=1x1 prawn arm bg|category=Category bg|categoryhover=Category hover bg|craft=Crafting bg|crafthover=Crafting hover bg}}.png|{{{width|128}}}px|link={{Linkless exists|{{{link|{{{icon|}}}}}} (Below Zero)|{{{link|{{{icon|}}}}}} (Below Zero)|{{{link|{{{icon|}}}}}}}}]]</div>}} |
||
<!-- Main Icon --> |
<!-- Main Icon --> |
||
<div style="position:absolute; left: calc( (100% - {{{width|128}}}px) / 2 );">[[File:{{{icon| |
<div style="position:absolute; left: calc( (100% - {{{width|128}}}px) / 2 ); bottom: calc( (100% - {{{width|128}}}px) / 2 );">[[File:{{#if: {{Filepath: {{{icon}}} Icon.png|nowiki}}|{{{icon}}} Icon|{{#if:{{Filepath: {{{icon}}} Icon (BZ).png|nowiki}}|{{{icon}}} Icon (BZ)|Unknown Icon}}}}.png|{{{iconwidth|{{{width|128}}}}}}px|link={{Linkless exists|{{{link|{{{icon|}}}}}} (Below Zero)|{{{link|{{{icon|}}}}}} (Below Zero)|{{{link|{{{icon|}}}}}}}}]]</div> |
||
</div></onlyinclude> |
</div></onlyinclude> |
||
This template displays an icon by overlaying a foreground image on a background image, and centers it within the parent element. |
This template displays an icon by overlaying a foreground image on a background image, and centers it within the parent element. |
||
Line 17: | Line 17: | ||
== Example == |
== Example == |
||
<pre> |
<pre> |
||
{{IconCreate|icon= |
{{IconCreate|icon=Uraninite Crystal|bg=normal|height=60|width=60}} |
||
</pre> |
</pre> |
||
'''Result:''' |
'''Result:''' |
||
{{IconCreate|icon= |
{{IconCreate|icon=Uraninite Crystal|bg=normal|height=60|width=60}} |
Latest revision as of 13:47, 6 August 2021


This template displays an icon by overlaying a foreground image on a background image, and centers it within the parent element.
Parameters
icon = foreground image; default is "Red Tablet" bg = background; default is "normal" width = icon width height = icon height
Example
{{IconCreate|icon=Uraninite Crystal|bg=normal|height=60|width=60}}
Result: