In other languages: Русский

Rich text: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(first draft)
 
No edit summary
 
(33 intermediate revisions by 14 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
Rich text formatting in allows the use of tags within most of the game's textboxes to change the visual formatting of text or to embed interactable images/entities. Predefined text tags are employed for this purpose.


Rich text formatting introduced in [[Version history#0.17.0|0.17.0]] allows the use of tags within most of the game's textboxes to change the visual formatting of text or to embed interactable images/entities. Predefined text tags are employed for this purpose.
== Tags ==


==Text modifiers==
Tags are useful for sharing blueprints, marking map locations in chat or adding icons to map markers and train stations.
Ctrl+alt clicking the map or ground will automatically insert a gps tag and post it into [[console|chat]].
 
Shift clicking most things with the console open will insert a tag for that thing into chat. The chat and many other textboxes in the game have a button on the right edge that opens an icon selector. This can be used to easily insert rich text tags of recipes, items, fluids, virtual signals and entities into the textbox.


The color and font of text can be changed
When used in chat, the tag image will be followed by a text description, except for the img tag.
Used elsewhere only the image is shown.


{| class="wikitable"
{| class="wikitable"
Line 13: Line 18:
! style="width:15%"| Example Result
! style="width:15%"| Example Result
! style="width:50%"| Description
! style="width:50%"| Description
|-
| [img=<i>class</i>/<i>name</i>]<br>
[img=<i>class</i>.<i>name</i>]<br>
[img=<i>sprite-prototype-name</i>]
| [img=item.iron-plate]<br>
[img=quantity-time]<br>
[img=utility/played_green]
| [[File:Iron_plate.png|28px]]<br>
[[File:Time_icon.png|28px]]<br>
[[File:Played green.png|28px]]
| Embeds only a small inline game graphic. The period format must be used in game save names. This tag uses [https://lua-api.factorio.com/latest/Concepts.html#SpritePath sprite paths]:
<i>class</i> is any of: item, entity, technology, recipe, item-group, fluid, tile, virtual-signal, achievement, equipment, space-location or utility.
<i>name</i>: see below
<i>sprite-prototype-name</i> is the [[Data.raw#sprite|internal-name]] of a [[Prototype/Sprite|sprite prototype]].
|-
|-
| <code>[color=<i>rgb</i>]...[/color]</code>
| [item=<i>name</i>]
| <code>[color=red]Red[/color] text</code>
| [item=iron-plate]
<code>[color=1,0,0]Red[/color] text</code>
| [[File:Iron_plate.png|28px]] [Item: Iron plate]
| <span style="color: #ff0000">Red</span> text
| <i>name</i> is the internal-name of the item
| <code><i>rgb</i></code> is a comma separated RGB color ranging from 0 to 1, or an English color name
 
|-
|-
| <code>[font</i>=<i>font-name</i>]...[/font]</code>
| [entity=<i>name</i>]
| <code>[font=default-bold]Bold text</code>
| [entity=small-biter]
| <b>Bold text</b>
| [[File:Small_biter.png|28px]] [Entity: Small biter]
| <code><i>font-name</i></code> is the name of the factorio font to render
| <i>name</i> is the internal-name of the entity
|}


==Tags==
|-
| [technology=<i>name</i>]
| [technology=logistics]
| [[File:Logistics_(research).png|28px]] [Technology: Logistics]
| <i>name</i> is the internal-name of the technology


Tags are useful for sharing blueprints, marking map locations in chat or adding icons to map markers and train stations.
|-
Ctrl+alt clicking the map or ground will automatically insert a gps tag and post it into chat.
| [recipe=<i>name</i>]
| [recipe=basic-oil-processing]
| [[File:Basic_oil_processing.png|28px]] [Recipe: Basic oil processing]
| <i>name</i> is the internal-name of the recipe, usually the item name


Shift clicking most things with the console open will insert a tag for that thing into chat.
|-
| [item-group=<i>name</i>]
| [item-group=combat]
| [[File:Item-group_military.png|28px]] [Item Group: Combat]
| <i>name</i> is any of: logistics, production, intermediate-products, combat, fluids or signals


{| class="wikitable"
|-
|-
! style="width:20%"| Syntax
| [fluid=<i>name</i>]
! style="width:15%"| Example Input
| [fluid=water]
! style="width:15%"| Example Result
| [[File:Water.png|28px]] [Fluid: Water]
! style="width:50%"| Description
| <i>name</i> is the internal name of the fluid


|-
|-
| <code>[img=<i>class</i>/<i>name</i>]</code>
| [tile=<i>name</i>]
<code>[img=<i>class</i>.<i>name</i>]</code>
| [tile=grass-3]
| <code>[img=item/iron-plate]</code>
| [[File:Grass_3.png|28px]] [Tile: Grass 3]
| [[File:Iron_plate.png|24px]]
| <i>name</i> is the internal name of the tile, usually the lowercase name with hyphens replacing spaces as written from the map editor
| Embeds only a small inline game graphic. The slash may be substituted for a period in save names.
<code><i>class</i></code> is any of: item, entity, technology, recipe, item-group, fluid, tile, virtual-signal or achievement
<code><i>name</i></code>: see below


|-
|-
| <code>[item=<i>name</i>]</code>
| [virtual-signal=<i>name</i>]
| <code>[item=iron-plate]</code>
| [virtual-signal=signal-A]
| [[File:Iron_plate.png|24px]]
| [[File:Signal-A.png|28px]] [Virtual Signal: Signal A]
| <code>name</code> is the internal-name of the item
| <i>name</i> is the word signal followed by either an uppercase letter, number, color, each, everything or anything


|-
|-
| <code>[entity=<i>name</i>]</code>
| [achievement=<i>name</i>]
| <code>[entity=small-biter]</code>
| [achievement=minions]
| [[File:Behemoth_biter.png|24px]]
| [[File:Minions-achievement.png|28px]] [Achievement: Minions]
| <code>name</code> is the internal-name of the entity
| <i>name</i> is the internal-name of the achievement, usually the lowercase name with hyphens replacing spaces


|-
|-
| <code>[technology=<i>name</i>]</code>
| [gps=<i>x,y</i>]
| <code>[technology=logistics]</code>
[gps=<i>x,y,surface</i>]
| [[File:Logistics_(research).png|24px]]
| [gps=0,0]
| <code>name</code> is the internal-name of the technology
| [[File:Map.png|28px]] [Location: 0,0]
| Embeds a map location and marks the location on the map of other players.
<i>x</i> is the x point coordinate<br>
<i>y</i> is the y point coordinate<br>
<i>surface</i> is the current surface. Is only added if the player Ctrl+alt clicks on a surface that is not the default surface. When the player is on another surface than <i>surface</i>, clicking the tag does nothing. Mods must handle this case with [https://lua-api.factorio.com/latest/events.html#on_player_clicked_gps_tag on_player_clicked_gps_tag]
|-
| [special-item=<i>blueprint_string</i>]
|
| [[File:Blueprint.png|28px]] [Blueprint]
| Embeds a blueprint. Players can get a blueprint item by clicking the icon.
<i>blueprint_string</i> is the blueprint string of a blueprint, deconstruction planner or upgrade planners


|-
|-
| <code>[recipe=<i>name</i>]</code>
| [armor=<i>player</i>]
| <code>[recipe=basic-oil-processing]</code>
| [armor=Player]  
| [[File:Basic_oil_processing.png|24px]]
| [[File:Power_armor_MK2.png|28px]] [Armor: Player]
| <code>name</code> is the internal-name of the recipe, usually the entity name
| Embeds the armor of a player. Allows other players to see the equipment installed.
<i>player</i> is the name of the player


|-
|-
| <code>[item-group=<i>name</i>]</code>
| [train=<i>number</i>]
| <code>[item-group=combat]</code>
| [train=93]  
| [[File:Item-group_military.png|24px]]
| [[File:Locomotive.png|28px]] [Train: 2]
| <code>name</code> is any of: logistics, production, intermediate-products, combat, fluids or signals
| Embeds a reference to a train. Clicking the icon will open the train GUI for that train.
<i>number</i> is the internal unit number of the train


|-
|-
| <code>[fluid=<i>name</i>]</code>
| [train-stop=<i>number</i>]
| <code>[fluid=water]</code>
| [train-stop=100]
| [[File:Water.png|24px]]
| [[File:Train_stop.png|28px]] [Train Stop: Trangar]
| <code>name</code> is the internal name of the fluid
| Embeds a reference to a train stop. Clicking the icon will open the GUI for that train stop.
<i>number</i> is the internal unit number of the train stop


|-
|-
| <code>[tile=<i>name</i>]</code>
| [shortcut=<i>shortcut-name</i>]
| <code>[tile=grass-3]</code>
| [shortcut=give-spidertron-remote]
| [[File:Grass_3.png|24px]]
| [[File:Spidertron_remote.png|28px]] [Shortcut: Create spidertron remote]
| <code>name</code> is the internal name of the tile, usually the lowercase name with hyphens replacing spaces as written from the map editor
| Embeds a reference to a shortcut from the [[Shortcut bar]]. Hovering over the rich text will show the shortcut's description. Clicking the rich text will act as if you clicked the shortcut.
<i>shortcut-name</i> is the internal name of the shortcut.


|-
|-
| <code>[virtual-signal=<i>name</i>]</code>
| [tip=<i>tip-name</i>]
| <code>[virtual-signal=signal-A]</code>
| [tip=spidertron-control]
| [[File:Signal-A.png|24px]]
| [[File:Tip.png|28px]] [Tip: Spidertron control]
| <code>name</code> is the word signal followed by either an uppercase letter, number, color, each, everything or anything
| Embeds a reference to a tip from the "Tips and tricks" menu. Hovering over the icon will show the tip's text. Clicking the icon will open the "Tips and tricks" menu to that page.


|-
|-
| <code>[achievement=<i>name</i>]</code>
| [tooltip=<i>text,tooltip locale key</i>]
| <code>[achievement=minions]</code>
| [tooltip=Hover to see "Iron plate",item-name.iron-plate]
| [[File:Minions-achievement.png|24px]]
| <span title="Iron plate"> [[File:Custom-tag-icon.png|28px]] Hover to see "Iron plate"</span>
| <code>name</code> is the internal-name of the achievement, usually the lowercase name with hyphens replacing spaces
| Shows the given <i>text</i> with a <i>tooltip</i> that is specified with a [[Tutorial:Localisation#Localising_simple_strings|locale key]].


|-
|-
| <code>[gps=<i>x</i>,<i>y</i>]</code>
| [quality=<i>tier</i>]<br>
| <code>map origin: [gps=0,0]</code>
[item=<i>name</i>,quality=<i>tier</i>]<br>
| map origin: [[File:Map.png|24px]]
[entity=<i>name</i>,quality=<i>tier</i>]<br>
| Embeds a map location and marks the location on the map of other players.
<!--[recipe=<i>name</i>,quality=<i>tier</i>]<br>
<code>x</code> is the x point coordinate
[fluid=<i>name</i>,quality=<i>tier</i>]<br>
<code>y</code> is the y point coordinate
[virtual-signal=<i>name</i>,quality=<i>tier</i>]-->
|[quality=normal]<br>
[item=iron-plate,quality=normal]<br>
[entity=small-biter,quality=uncommon]<br>
<!--[recipe=basic-oil-processing,quality=rare]<br>
[fluid=water,quality=epic]<br>
[virtual-signal=signal-A,quality=legendary]-->
| [[File:Quality normal.png|28px]] [Quality: Normal]<br>
[[File:Iron_plate.png|28px]] [Item: Iron plate]<br>
[[File:Uncommon small biter.png|28px]] [Entity: Uncommon Small biter]<br>
|
[[Quality]] can also be optionally specified on the following tags: item, entity, recipe, fluid, and virtual-signal<br>
It can also be added to the other tags that use <i>name</i>, but they ignore it.
 
The normal quality is the default quality and won't modify tags. Any other quality won't exist without [[Space Age]] and Quality
 
<i>tier</i> is the internal-name of the quality


|-
|-
| <code>[special-item=<i>blueprint_string</i>]</code>
| [space-platform=<i>number</i>]
|  
| [space-platform=3]
|  
| [[File:Space_platform_hub.png|28px]] [Space platform: My cool space platform]
| Embeds a blueprint. Other players can get a blueprint item by clicking the icon
| <i>number</i> is the internal id of a space-platform, starting with 1.
<code>blueprint_string</code> is the blueprint string of a blueprint, deconstruction planner or upgrade planners
Hovering over the rich text will show a view of the space platform. Clicking the rich text will go to the platform in remote view.


|-
|-
| <code>[armor=<i>player</i>]</code>
| [planet=<i>name</i>]
| <code>[armor=Bilka]</code>
| [planet=gleba]
|  
| [[File:Gleba.png|28px]] [Planet: Gleba]
| Embeds the armor of a player. Allows other players to see the equipment installed.
| <i>name</i> is the internal name of a planet.
<code>player</code> is the name of the player
Available planets in Space Age are: nauvis, gleba, fulgora, vulcanus, and aquilo.
 
[[Nauvis]] is part of the base game and will always be available.


|-
|-
| <code>[train=<i>number</i>]</code>
| [space-location=<i>name</i>]
| <code>[train=93]</code>
| [space-location=shattered-planet]
|
[space-location=gleba]
| Embeds a reference to a train. Clicking the icon will open the train GUI for that train.
| [[File:Shattered Planet.png|28px]] [Space location: Shattered Planet]
<code>number</code> is the ingame number of the train
[[File:Gleba.png|28px]] [Planet: Gleba]
| <i>name</i> is the internal name of a space-location in Space Age.
Available locations in Space Age are: nauvis, gleba, fulgora, vulcanus, aquilo, solar-system-edge, and shattered-planet.
 
For the planet's listed in the section above 'planet' will be used as the text prefix instead of 'space-location'


|-
|-
| <code>[train-stop=<i>number</i>]</code>
| [space-age]
| <code>[train-stop=100]</code>
| [space-age]
|  
| [[File:Space_age_icon.png|28px]]
| Embeds a reference to a train stop. Clicking the icon will open the GUI for that train stop.
| Embeds the Space Age icon.
<code>number</code> is the ingame number of the train
|}
 
== Text modifiers ==
[[File:Fonts.png|right|thumbnail|100px|Different fonts displayed in-game. (Click to enlarge.)]]
 
The color and font of text can be changed


{| class="wikitable"
|-
! style="width:20%"| Syntax
! style="width:15%"| Example Input
! style="width:15%"| Example Result
! style="width:50%"| Description
|-
| [color=<i>rgb</i>]...[/color]<br>
[color=<i>#rrggbb</i>]...[/color]<br>
[color=<i>#aarrggbb</i>]...[/color]<br>
[color=<i>rgb</i>]...[.color]<br>
[color=<i>#rrggbb</i>]...[.color]<br>
[color=<i>#aarrggbb</i>]...[.color]
| [color=red]Red[/color] text<br>
[color=1,0,0]Red[/color] text<br>
[color=255,0,0]Red[/color] text<br>
[color=#ff0000]Red[/color] text
| <span style="color: #ff0000">Red</span> text
| <i>rgb</i> is a comma separated RGB color ranging from 0 to 1 or 0 to 255, or a color name
Available colors: default, red, green, blue, orange, yellow, pink, purple, white, black, gray, brown, cyan, acid.
|-
| [font=<i>font-name</i>]...[/font]<br>
[font=<i>font-name</i>]...[.font]
| [font=default-bold]Bold text[/font]
| <b>Bold text</b>
| <i>font-name</i> is the name of the [[Data.raw#font|Factorio font]] to render
|}
|}
== See also ==
* [[Console]]
* [[Data.raw]] for the list of internal names of recipes, technologies, fluids, etc.
{{C|GUI}}

Latest revision as of 00:14, 8 November 2024

Rich text formatting in allows the use of tags within most of the game's textboxes to change the visual formatting of text or to embed interactable images/entities. Predefined text tags are employed for this purpose.

Tags

Tags are useful for sharing blueprints, marking map locations in chat or adding icons to map markers and train stations. Ctrl+alt clicking the map or ground will automatically insert a gps tag and post it into chat.

Shift clicking most things with the console open will insert a tag for that thing into chat. The chat and many other textboxes in the game have a button on the right edge that opens an icon selector. This can be used to easily insert rich text tags of recipes, items, fluids, virtual signals and entities into the textbox.

When used in chat, the tag image will be followed by a text description, except for the img tag. Used elsewhere only the image is shown.

Syntax Example Input Example Result Description
[img=class/name]

[img=class.name]
[img=sprite-prototype-name]

[img=item.iron-plate]

[img=quantity-time]
[img=utility/played_green]

Iron plate.png

Time icon.png
Played green.png

Embeds only a small inline game graphic. The period format must be used in game save names. This tag uses sprite paths:

class is any of: item, entity, technology, recipe, item-group, fluid, tile, virtual-signal, achievement, equipment, space-location or utility.

name: see below

sprite-prototype-name is the internal-name of a sprite prototype.

[item=name] [item=iron-plate] Iron plate.png [Item: Iron plate] name is the internal-name of the item
[entity=name] [entity=small-biter] Small biter.png [Entity: Small biter] name is the internal-name of the entity
[technology=name] [technology=logistics] Logistics (research).png [Technology: Logistics] name is the internal-name of the technology
[recipe=name] [recipe=basic-oil-processing] Basic oil processing.png [Recipe: Basic oil processing] name is the internal-name of the recipe, usually the item name
[item-group=name] [item-group=combat] Item-group military.png [Item Group: Combat] name is any of: logistics, production, intermediate-products, combat, fluids or signals
[fluid=name] [fluid=water] Water.png [Fluid: Water] name is the internal name of the fluid
[tile=name] [tile=grass-3] Grass 3.png [Tile: Grass 3] name is the internal name of the tile, usually the lowercase name with hyphens replacing spaces as written from the map editor
[virtual-signal=name] [virtual-signal=signal-A] Signal-A.png [Virtual Signal: Signal A] name is the word signal followed by either an uppercase letter, number, color, each, everything or anything
[achievement=name] [achievement=minions] Minions-achievement.png [Achievement: Minions] name is the internal-name of the achievement, usually the lowercase name with hyphens replacing spaces
[gps=x,y]

[gps=x,y,surface]

[gps=0,0] Map.png [Location: 0,0] Embeds a map location and marks the location on the map of other players.

x is the x point coordinate
y is the y point coordinate
surface is the current surface. Is only added if the player Ctrl+alt clicks on a surface that is not the default surface. When the player is on another surface than surface, clicking the tag does nothing. Mods must handle this case with on_player_clicked_gps_tag

[special-item=blueprint_string] Blueprint.png [Blueprint] Embeds a blueprint. Players can get a blueprint item by clicking the icon.

blueprint_string is the blueprint string of a blueprint, deconstruction planner or upgrade planners

[armor=player] [armor=Player] Power armor MK2.png [Armor: Player] Embeds the armor of a player. Allows other players to see the equipment installed.

player is the name of the player

[train=number] [train=93] Locomotive.png [Train: 2] Embeds a reference to a train. Clicking the icon will open the train GUI for that train.

number is the internal unit number of the train

[train-stop=number] [train-stop=100] Train stop.png [Train Stop: Trangar] Embeds a reference to a train stop. Clicking the icon will open the GUI for that train stop.

number is the internal unit number of the train stop

[shortcut=shortcut-name] [shortcut=give-spidertron-remote] Spidertron remote.png [Shortcut: Create spidertron remote] Embeds a reference to a shortcut from the Shortcut bar. Hovering over the rich text will show the shortcut's description. Clicking the rich text will act as if you clicked the shortcut.

shortcut-name is the internal name of the shortcut.

[tip=tip-name] [tip=spidertron-control] Tip.png [Tip: Spidertron control] Embeds a reference to a tip from the "Tips and tricks" menu. Hovering over the icon will show the tip's text. Clicking the icon will open the "Tips and tricks" menu to that page.
[tooltip=text,tooltip locale key] [tooltip=Hover to see "Iron plate",item-name.iron-plate] Custom-tag-icon.png Hover to see "Iron plate" Shows the given text with a tooltip that is specified with a locale key.
[quality=tier]

[item=name,quality=tier]
[entity=name,quality=tier]

[quality=normal]

[item=iron-plate,quality=normal]
[entity=small-biter,quality=uncommon]

Quality normal.png [Quality: Normal]

Iron plate.png [Item: Iron plate]
Uncommon small biter.png [Entity: Uncommon Small biter]

Quality can also be optionally specified on the following tags: item, entity, recipe, fluid, and virtual-signal
It can also be added to the other tags that use name, but they ignore it.

The normal quality is the default quality and won't modify tags. Any other quality won't exist without Space Age and Quality

tier is the internal-name of the quality

[space-platform=number] [space-platform=3] Space platform hub.png [Space platform: My cool space platform] number is the internal id of a space-platform, starting with 1.

Hovering over the rich text will show a view of the space platform. Clicking the rich text will go to the platform in remote view.

[planet=name] [planet=gleba] Gleba.png [Planet: Gleba] name is the internal name of a planet.

Available planets in Space Age are: nauvis, gleba, fulgora, vulcanus, and aquilo.

Nauvis is part of the base game and will always be available.

[space-location=name] [space-location=shattered-planet]

[space-location=gleba]

Shattered Planet.png [Space location: Shattered Planet]

Gleba.png [Planet: Gleba]

name is the internal name of a space-location in Space Age.

Available locations in Space Age are: nauvis, gleba, fulgora, vulcanus, aquilo, solar-system-edge, and shattered-planet.

For the planet's listed in the section above 'planet' will be used as the text prefix instead of 'space-location'

[space-age] [space-age] Space age icon.png Embeds the Space Age icon.

Text modifiers

Different fonts displayed in-game. (Click to enlarge.)

The color and font of text can be changed

Syntax Example Input Example Result Description
[color=rgb]...[/color]

[color=#rrggbb]...[/color]
[color=#aarrggbb]...[/color]
[color=rgb]...[.color]
[color=#rrggbb]...[.color]
[color=#aarrggbb]...[.color]

[color=red]Red[/color] text

[color=1,0,0]Red[/color] text
[color=255,0,0]Red[/color] text
[color=#ff0000]Red[/color] text

Red text rgb is a comma separated RGB color ranging from 0 to 1 or 0 to 255, or a color name

Available colors: default, red, green, blue, orange, yellow, pink, purple, white, black, gray, brown, cyan, acid.

[font=font-name]...[/font]

[font=font-name]...[.font]

[font=default-bold]Bold text[/font] Bold text font-name is the name of the Factorio font to render

See also

  • Console
  • Data.raw for the list of internal names of recipes, technologies, fluids, etc.