Template:Icon/doc: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Created page with "<code><nowiki>{{icon|File name|</nowiki>text|Page name|color=''hex color code''|icon-text-class=''html/css class''}}</code> * First parameter: The name of the icon file. Usua...")
 
(Added ability to mark icons as only space age or no space age)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<code><nowiki>{{icon|File name|</nowiki>text|Page name|color=''hex color code''|icon-text-class=''html/css class''}}</code>
<code><nowiki>{{icon|File name|</nowiki>text|Page name|color=''hex color code''|icon-text-class=''html/css class''|space-age=yes/no}}</code>


* 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)
* 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)
Line 6: Line 6:
* Color parameter: A hex color code without the #. Determines the background color of the icon e.g. ffffff for white. (Optional, default: 929292)
* 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)
* 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)
* Space age parameter: Either the string <code>yes</code>, <code>no</code> or nothing. Determines whether to display a symbol in the top right of the icon that shows whether the linked item/recipe/technology is exclusive to space age ( <code>yes</code>) or only available if space age is deactivated (<code>no</code>). Most items are available with and without space age, in that case this parameter should be left out. (Optional, default: unset)


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):
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):
Line 12: Line 13:
Some usage examples:
Some usage examples:


* <nowiki>{{icon|not working icon|color=ff00ff}}</nowiki> → {{icon|not working icon|color=ff00ff}}
* <nowiki>{{Icon|Intentionally missing image|color=ff00ff}}</nowiki> → {{Icon|Intentionally missing image|color=ff00ff}}
* <nowiki>{{icon|Tree|color=0000ff}}</nowiki> → {{icon|Tree|color=0000ff}}
* <nowiki>{{Icon|Tree|color=0000ff}}</nowiki> → {{Icon|Tree|color=0000ff}}
* <nowiki>{{icon|Iron plate||Copper plate}}</nowiki> → {{icon|Iron plate||Copper plate}}
* <nowiki>{{Icon|Iron plate||Copper plate}}</nowiki> → {{Icon|Iron plate||Copper plate}}
* <nowiki>{{icon|Iron plate|text}}</nowiki> → {{icon|Iron plate|text}}
* <nowiki>{{Icon|Iron plate|text}}</nowiki> → {{Icon|Iron plate|text}}
* <nowiki>{{icon|automobilism (research)|icon-text-class=navbox-icon-text|some text}}</nowiki> → {{icon|automobilism (research)|icon-text-class=navbox-icon-text|some text}}
* <nowiki>{{Icon|automobilism (research)|icon-text-class=navbox-icon-text|some text}}</nowiki> → {{Icon|automobilism (research)|icon-text-class=navbox-icon-text|some text}}
* <nowiki>{{Icon|Satellite|space-age=no}}</nowiki> → {{Icon|Satellite|space-age=no}}
* <nowiki>{{Icon|Big mining drill|space-age=yes}}</nowiki> → {{Icon|Big mining drill|space-age=yes}}

Latest revision as of 10:18, 18 October 2024

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

  • 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)
  • Space age parameter: Either the string yes, no or nothing. Determines whether to display a symbol in the top right of the icon that shows whether the linked item/recipe/technology is exclusive to space age ( yes) or only available if space age is deactivated (no). Most items are available with and without space age, in that case this parameter should be left out. (Optional, default: unset)

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
  • {{Icon|Satellite|space-age=no}} →
    Satellite.png
  • {{Icon|Big mining drill|space-age=yes}} →
    Big mining drill.png