Factorio Prototype DocsVersion 1.1.107

IconData :: struct Example code

Icon layering follows the following rules:

  • The rendering order of the individual icons follows the array order: Later added icons (higher index) are drawn on top of previously added icons (lower index).

  • Only the first icon layer will display a shadow.

  • When the final icon is displayed with transparency (e.g. a faded out alert), the icon layer overlap may look undesirable.

  • The final combination of icons will always be resized in GUI based on the first icon layer's size, but won't be resized when displayed on machines in alt-mode. For example: recipe first icon layer is size 128, scale 1, the icon group will be displayed at resolution /4 to fit the 32px GUI boxes, but will be displayed 4 times as large on buildings.

  • Shift values are based on final size (icon_size * scale) of the first icon layer.

Properties

icon :: FileName

Path to the icon file.

Path to the icon file.

icon_size optional :: SpriteSizeType

The size of the square icon, in pixels. [...]

The size of the square icon, in pixels. [...]

tint optional :: Color

The tint to apply to the icon.

The tint to apply to the icon.

shift optional :: Vector

Used to offset the icon "layer" from the overall icon. [...]

Used to offset the icon "layer" from the overall icon. [...]

scale optional :: double

Defaults to 32/icon_size for items and recipes, and 256/icon_size for technologies. [...]

Defaults to 32/icon_size for items and recipes, and 256/icon_size for technologies. [...]

icon_mipmaps optional :: IconMipMapType

Icons of reduced size will be used at decreased scale.

Icons of reduced size will be used at decreased scale.

Properties

icon :: FileName

Path to the icon file.

icon_size :: SpriteSizeType optional

The size of the square icon, in pixels. E.g. 32 for a 32px by 32px icon.

Mandatory if icon_size is not specified outside of icons.

tint :: Color optional

Default: {r=1, g=1, b=1, a=1}

The tint to apply to the icon.

shift :: Vector optional

Default: {0, 0}

Used to offset the icon "layer" from the overall icon. The shift is applied from the center (so negative shifts are left and up, respectively). Shift values are based on final size (icon_size * scale) of the first icon.

scale :: double optional

Defaults to 32/icon_size for items and recipes, and 256/icon_size for technologies.

Specifies the scale of the icon on the GUI scale. A scale of 2 means that the icon will be two times bigger on screen (and thus more pixelated).

icon_mipmaps :: IconMipMapType optional

Default: 0

Icons of reduced size will be used at decreased scale.

Examples

-- one icon layer
{
  icon = "__base__/graphics/icons/fluid/heavy-oil.png",
  icon_size = 64,
  scale = 0.5,
  shift = {4, -8}
}
-- Layered icon, with size defined outside of layers
icon_size = 32,
icons = {
  {
    icon = "__base__/graphics/icons/fluid/barreling/empty-barrel.png"
  },
  {
    icon = "__base__/graphics/icons/fluid/barreling/barrel-side-mask.png",
    tint = { a = 0.75,  b = 0, g = 0, r = 0 }
  },
  {
    icon = "__base__/graphics/icons/fluid/barreling/barrel-hoop-top-mask.png",
    tint = { a = 0.75, b = 0.5, g = 0.5, r = 0.5 }
  }
}
-- Layered icon, with size defined per layer
icons = {
  {
    icon = "__base__/graphics/icons/fluid/barreling/barrel-empty.png",
    icon_size = 32
  },
  {
    icon = "__base__/graphics/icons/fluid/barreling/barrel-empty-side-mask.png",
    icon_size = 32,
    tint = { a = 0.75, b = 0, g = 0, r = 0 }
  },
  {
    icon = "__base__/graphics/icons/fluid/barreling/barrel-empty-top-mask.png",
    icon_size = 32,
    tint = { a = 0.75, b = 0.5, g = 0.5, r = 0.5 }
  },
  {
    icon = "__base__/graphics/icons/fluid/crude-oil.png",
    icon_size = 32,
    scale = 0.5,
    shift = {7, 8 }
  }
}

Prototypes

Types