Template:Icon: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
No edit summary
m (doc)
 
(23 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<div class="icon" style="display:inline-block; margin:5px; position:relative; padding:3px; width:32px; height:32px; background-color:#999; border:1px solid #ccc;">{{#ifexist: File:{{ConvertName|{{{1}}}}}.png | [[File:{{ConvertName|{{{1}}}}}.png{{!}}32px{{!}}link={{#if: {{{3|}}} |{{{3}}}|{{{1}}}{{If language suffix}}}}]] | [[File:Placeholder icon.png{{!}}link=]] <includeonly><div style="display:none;">[[File:{{{1}}}.png{{!}}32px]]</div></includeonly>}}<div style="position:absolute; bottom:0; right:3px; color:#fff; font-size:larger;">{{{2|}}}</div></div><noinclude>
<div class="factorio-icon" style="background-color:#{{{color|929292}}};">{{#ifexist: File:{{ConvertName|{{{1}}}}}.png | [[File:{{ConvertName|{{{1}}}}}.png{{!}}32px{{!}}link={{{3|{{{1}}}{{If language suffix}}}}}]] | [[File:Placeholder icon.png{{!}}link=]] <includeonly><div style="display:none;">[[File:{{ConvertName|{{{1}}}}}.png{{!}}32px]]</div></includeonly>}}<div class="{{{icon-text-class|factorio-icon-text}}}">{{{2|}}}</div></div><noinclude>{{doc}}
 
==Usage==
<pre>
{{icon|Logistics|2|Logistics_2}}
</pre>
Produces:
 
{{icon|Logistics|2|Logistics_2}}
</noinclude>
</noinclude>

Latest revision as of 19:05, 1 September 2017

Placeholder icon.png

[View] [Edit] [Page history]

Documentation

{{icon|File name|text|Page name|color=hex color code|icon-text-class=html/css class}}

  • First parameter: The name of the icon file. Usually the in-game name of the item, e.g. "Raw fish". The file name is converted using Template:ConvertName, which for example resolves the input of "Battery MK1" to battery-equipment. (Required)
  • Second parameter: Text to display on top of the icon. (Optional)
  • Third parameter: The name of the page the icon links to. If this parameter is completely empty, the first parameter will be used instead of this one. The template adds the language suffix (of the language the page is on) to the link e.g. Wood links to Wood/de on a German page. (Optional)
  • Color parameter: A hex color code without the #. Determines the background color of the icon e.g. ffffff for white. (Optional, default: 929292)
  • Icon text class parameter: A html class associated with some css code. Determines how the number is displayed on the icon. Currently unused. (Optional, default: factorio-icon-text)

Putting two pipes after the first parameter will produce an icon that links to nothing and shows no number (useful if you don't want to link to a page that doesn't exist):

{{icon|dead-tree||}} →
Dead-tree.png

Some usage examples:

  • {{icon|Intentionally missing image|color=ff00ff}} →
  • {{icon|Tree|color=0000ff}} →
    Tree.png
  • {{icon|Iron plate||Copper plate}} →
    Iron plate.png
  • {{icon|Iron plate|text}} →
    Iron plate.png
    text
  • {{icon|automobilism (research)|icon-text-class=navbox-icon-text|some text}} →
    Automobilism (research).png
List of all templates