Rich text: Difference between revisions
Phoenix27833 (talk | contribs) (first draft) |
(Adjusted the spritename img tag info) |
||
(17 intermediate revisions by 6 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. | |||
== 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 [[console|chat]]. | |||
The | 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. | |||
{| 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] | |||
| [[File:Iron_plate.png|28px]]<br> | |||
[[File:Time_icon.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 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]]. | |||
|- | |- | ||
| [item=<i>name</i>] | |||
| [item=iron-plate] | |||
| [[File:Iron_plate.png|28px]] [Item: Iron plate] | |||
| <i>name</i> is the internal-name of the item | |||
| | |||
| | |||
| [[File:Iron_plate.png| | |||
| | |||
|- | |- | ||
| | | [entity=<i>name</i>] | ||
| | | [entity=small-biter] | ||
| [[File: | | [[File:Small_biter.png|28px]] [Entity: Small biter] | ||
| < | | <i>name</i> is the internal-name of the entity | ||
|- | |- | ||
| | | [technology=<i>name</i>] | ||
| | | [technology=logistics] | ||
| [[File: | | [[File:Logistics_(research).png|28px]] [Technology: Logistics] | ||
| < | | <i>name</i> is the internal-name of the technology | ||
|- | |- | ||
| | | [recipe=<i>name</i>] | ||
| | | [recipe=basic-oil-processing] | ||
| [[File: | | [[File:Basic_oil_processing.png|28px]] [Recipe: Basic oil processing] | ||
| < | | <i>name</i> is the internal-name of the recipe, usually the item name | ||
|- | |- | ||
| | | [item-group=<i>name</i>] | ||
| | | [item-group=combat] | ||
| [[File: | | [[File:Item-group_military.png|28px]] [Item Group: Combat] | ||
| < | | <i>name</i> is any of: logistics, production, intermediate-products, combat, fluids or signals | ||
|- | |- | ||
| | | [fluid=<i>name</i>] | ||
| | | [fluid=water] | ||
| [[File: | | [[File:Water.png|28px]] [Fluid: Water] | ||
| < | | <i>name</i> is the internal name of the fluid | ||
|- | |- | ||
| | | [tile=<i>name</i>] | ||
| | | [tile=grass-3] | ||
| [[File: | | [[File:Grass_3.png|28px]] [Tile: Grass 3] | ||
| < | | <i>name</i> is the internal name of the tile, usually the lowercase name with hyphens replacing spaces as written from the map editor | ||
|- | |- | ||
| | | [virtual-signal=<i>name</i>] | ||
| | | [virtual-signal=signal-A] | ||
| [[File: | | [[File:Signal-A.png|28px]] [Virtual Signal: Signal A] | ||
| < | | <i>name</i> is the word signal followed by either an uppercase letter, number, color, each, everything or anything | ||
|- | |- | ||
| | | [achievement=<i>name</i>] | ||
| | | [achievement=minions] | ||
| [[File: | | [[File:Minions-achievement.png|28px]] [Achievement: Minions] | ||
| < | | <i>name</i> is the internal-name of the achievement, usually the lowercase name with hyphens replacing spaces | ||
|- | |- | ||
| | | [gps=<i>x,y</i>] | ||
[gps=<i>x,y,surface</i>] | |||
| [gps=0,0] | |||
| [[File:Map.png|28px]] [Location: 0,0] | |||
| | |||
| | |||
| Embeds a map location and marks the location on the map of other players. | | 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>] | ||
| | | | ||
| Embeds a blueprint. | | [[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 | |||
|- | |- | ||
| | | [armor=<i>player</i>] | ||
| | | [armor=Player] | ||
| | | [[File:Power_armor_MK2.png|28px]] [Armor: Player] | ||
| Embeds the armor of a player. Allows other players to see the equipment installed. | | Embeds the armor of a player. Allows other players to see the equipment installed. | ||
< | <i>player</i> is the name of the player | ||
|- | |- | ||
| | | [train=<i>number</i>] | ||
| | | [train=93] | ||
| | | [[File:Locomotive.png|28px]] [Train: 2] | ||
| Embeds a reference to a train. Clicking the icon will open the train GUI for that train. | | 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 | ||
|- | |- | ||
| | | [train-stop=<i>number</i>] | ||
| | | [train-stop=100] | ||
| | | [[File:Train_stop.png|28px]] [Train Stop: Trangar] | ||
| Embeds a reference to a train stop. Clicking the icon will open the GUI for that train stop. | | 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 | ||
|- | |||
| [tooltip=<i>text,tooltip locale key</i>] | |||
| [tooltip=Hover to see "Iron plate",item-name.iron-plate] | |||
| <span title="Iron plate"> [[File:Custom-tag-icon.png|28px]] Hover to see "Iron plate"</span> | |||
| Shows the given <i>text</i> with a <i>tooltip</i> that is specified with a [[Tutorial:Localisation#Localising_simple_strings|locale key]]. | |||
|} | |} | ||
== 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. |
Latest revision as of 11:27, 2 December 2020
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=item.iron-plate] [img=quantity-time] |
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 or utility. name: see below sprite-prototype-name is the internal-name of a sprite prototype. | |
[item=name] | [item=iron-plate] | [Item: Iron plate] | name is the internal-name of the item |
[entity=name] | [entity=small-biter] | [Entity: Small biter] | name is the internal-name of the entity |
[technology=name] | [technology=logistics] | [Technology: Logistics] | name is the internal-name of the technology |
[recipe=name] | [recipe=basic-oil-processing] | [Recipe: Basic oil processing] | name is the internal-name of the recipe, usually the item name |
[item-group=name] | [item-group=combat] | [Item Group: Combat] | name is any of: logistics, production, intermediate-products, combat, fluids or signals |
[fluid=name] | [fluid=water] | [Fluid: Water] | name is the internal name of the fluid |
[tile=name] | [tile=grass-3] | [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] | [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] | [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] | [Location: 0,0] | Embeds a map location and marks the location on the map of other players.
x is the x point coordinate |
[special-item=blueprint_string] | [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] | [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] | [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: 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 |
[tooltip=text,tooltip locale key] | [tooltip=Hover to see "Iron plate",item-name.iron-plate] | Hover to see "Iron plate" | Shows the given text with a tooltip that is specified with a locale key. |
Text modifiers
The color and font of text can be changed
Syntax | Example Input | Example Result | Description |
---|---|---|---|
[color=rgb]...[/color] [color=#rrggbb]...[/color] |
[color=red]Red[/color] text [color=1,0,0]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 |