A comprehensive set of standalone icon and sprite utilities for Factorio mod development. Originally developed to support the Artisanal Reskins ecosystem, this library provides robust tools for manipulating icons, sprites, and prototypes with full type safety and extensive validation.
Lua libraries for use by other mods and submods that are parts of a larger mod.
Version: 0.2.1
Date: 2026-07-19
Features:
- Added `utils` module, with `utils.array_concat` to concatenate any number of array inputs of the same type into a single array
- Added `sprites.make_4way_working_visualisations_from_spritesheet`
Changes:
- Improved types of `prototype` parameters to `icons.clear_icon_from_prototype` and `icons.add_icons_from_prototype_to_icons` to include all prototypes that may have an icon
- `icons.assign_icons_to_prototype_and_related_prototypes` now assigns icons to related recipes of the same name that produce only the same item; where possible, if icon inheritance is permitted, the recipe icon will be cleared
- The following methods now throw when the prototype (directly as a parameter or indirectly by name and type) is nil:
- `icons.add_icons_from_prototype_to_icon`
- `icons.add_icons_from_prototype_to_icons`
- `icons.add_icons_from_prototype_to_icon_by_name`
- `icons.add_icons_from_prototype_to_icons_by_name`
- `icons.get_icon_from_named_prototype`
- Revised `icons.transform_icon` to handle the single-icon case, and added `icons.transform_icons` for the layered icon case
- `sprites.rescale_remnants_of_prototype` now works with the array form of `prototype.corpse` for entities with many corpse references
- `sprites.make_rotated_animation_variations_from_spritesheet` and `sprites.make_4way_animation_from_spritesheet` now handle `size` as the means to specify width/height
Bugfixes:
- Fixed that `icons.get_dark_background_icon_from_prototype` and `icons.get_starmap_icon_from_prototype` could return an invalid icon if the target icon was not available; the methods both now return nil in that case
Deprecated:
- `colors.from_argb` is deprecated with the introduction of EmmyLua (and removal of sumneko) by the Factorio Modding Tool Kit, which correctly handles RGBA color strings
Version: 0.2.0
Date: 2026-06-26
Features:
- Updated for Factorio 2.1
Bugfixes:
- Icon methods now correctly pass-through the `draw_background` and `floating` properties on icons
Version: 0.1.1
Date: 2026-06-07
Changes:
- Revised `icons.assign_icons_to_prototype_and_related_prototypes` to pattern match for explosion/remnant related entities, as well as retrieve the first configured explosion and corpse for updates, if available on the prototype
Version: 0.1.0
Date: 2026-06-06
Features:
- Added `sprites.make_rotated_animation_variations_from_spritesheet`, a typed variant of the base-mod equivalent method
- Added `sprites.get_rescaled_prototype`, a non-mutating counterpart to `sprites.rescale_prototype` that returns a rescaled copy
- Added `colors.rgba_to_hsva` and `colors.rgba_to_hsla` for converting RGBA colors to HSVA and HSLA color spaces respectively
- Added `colors.hsva_to_rgba` and `colors.hsla_to_rgba` for converting HSVA and HSLA colors back to RGBA
- Added `colors.normalize` for normalizing a color's channel values to between 0 and 1
- Added `colors.overlay` for alpha-compositing an overlay color on top of a base color in linear light
- Added `colors.blend` for blending two colors uniformly in perceptual color space using Oklab
Changes:
- Revised `icons.get_icon_from_prototype` to throw on nil input rather than return nil; the method will now either throw or return an icon
Version: 0.0.3
Date: 2026-05-10
Bugfixes:
- Fixed that recipe prototypes would have their icon cleared when an icon was required in some circumstances
Version: 0.0.2
Date: 2026-05-08
Features:
- Added new `colors` module with method `colors.from_argb` method taking an 8-character ARGB hex code and converting it to a Factorio RGBA color vector
Changes:
- Added "default" as the first item in IconDefaultsType to support tab-autocomplete
Version: 0.0.1
Date: 2026-01-11
Features:
- Initial release