Generates app icons for Android and iOS from either a random robot avatar (using Avatarz) or a provided source image (using Image).
When the image dep is not available, falls back to the bundled Mob logo
(pre-built PNGs shipped with mob_dev, no system tools required).
Android sizes (mipmap buckets)
| Bucket | px |
|---|---|
| mdpi | 48 |
| hdpi | 72 |
| xhdpi | 96 |
| xxhdpi | 144 |
| xxxhdpi | 192 |
iOS sizes (AppIcon.appiconset subset)
| Usage | px |
|---|---|
| iPhone Notification 2x | 40 |
| iPhone Notification 3x | 60 |
| iPhone Settings 2x | 58 |
| iPhone Settings 3x | 87 |
| iPhone Spotlight 2x | 80 |
| iPhone Spotlight 3x | 120 |
| iPhone App 2x | 120 |
| iPhone App 3x | 180 |
| iPad Notification 1x | 20 |
| iPad Notification 2x | 40 |
| iPad Settings 1x | 29 |
| iPad Settings 2x | 58 |
| iPad Spotlight 1x | 40 |
| iPad Spotlight 2x | 80 |
| iPad App 1x | 76 |
| iPad App 2x | 152 |
| iPad Pro App 2x | 167 |
| App Store | 1024 |
Summary
Functions
Returns the XML body for mipmap-anydpi-v26/ic_launcher.xml.
Returns the map of Android mipmap bucket names to pixel dimensions for adaptive-icon foreground layers (108×108 dp scaled per density).
Returns the map of Android mipmap bucket names to pixel dimensions for legacy (single-layer) icons.
Returns the XML body for values/ic_launcher_background.xml defining
the adaptive icon background colour.
Generates adaptive Android icons from a source image.
Resizes an existing image at source_path to the icon sizes of each
platform the project has (platforms/1), writing them into output_dir.
Generates a random robot avatar and writes platform icons into output_dir.
Returns the list of iOS icon pixel dimensions.
The platforms whose native project exists in project_dir (android/,
ios/). Icons are written only for these, so an --android project never
grows an ios/Assets.xcassets tree (and vice versa).
The project's platforms that have no launcher icon yet. mix mob.install
writes its placeholder only to these, leaving existing (possibly custom)
icons alone.
Copies the bundled Mob logo (pre-built PNGs) to the icon directories of
platforms (default: every platform the project has, platforms/1). Used
as the default placeholder icon by mix mob.install. No extra dependencies
or system tools required.
Functions
@spec adaptive_icon_xml() :: String.t()
Returns the XML body for mipmap-anydpi-v26/ic_launcher.xml.
Uses @mipmap/ic_launcher_foreground for the foreground and
@color/ic_launcher_background for the background.
@spec adaptive_sizes() :: %{required(String.t()) => pos_integer()}
Returns the map of Android mipmap bucket names to pixel dimensions for adaptive-icon foreground layers (108×108 dp scaled per density).
@spec android_sizes() :: %{required(String.t()) => pos_integer()}
Returns the map of Android mipmap bucket names to pixel dimensions for legacy (single-layer) icons.
Returns the XML body for values/ic_launcher_background.xml defining
the adaptive icon background colour.
Accepts hex strings with or without a leading # (case-insensitive).
Raises ArgumentError for non-hex input.
Generates adaptive Android icons from a source image.
Writes:
mipmap-anydpi-v26/ic_launcher.xml+ic_launcher_round.xmlreferencing@mipmap/ic_launcher_foregroundand@color/ic_launcher_backgroundmipmap-<bucket>/ic_launcher_foreground.pngat the adaptive icon canvas size for each density bucketvalues/ic_launcher_background.xmldefining the background color
Options
:background_color— hex string like"#E8B53C". If absent, sampled from the source image at top-centre (10% from the top).
Legacy ic_launcher.png/ic_launcher_round.png are written separately
by generate_from_source/2 for older Android versions.
Resizes an existing image at source_path to the icon sizes of each
platform the project has (platforms/1), writing them into output_dir.
Options
:background_color— hex string like"#E8B53C"used to flatten the iOS icons (which must be opaque — Apple rejects any alpha channel on the App Store marketing icon, error 90717). Android icons keep their transparency. If absent, the colour is sampled from the source (same as the adaptive-icon background), so the two platforms stay consistent.
Returns :ok.
Generates a random robot avatar and writes platform icons into output_dir.
Creates, for each platform the project has (platforms/1):
output_dir/android/app/src/main/res/<bucket>/ic_launcher.pngfor each Android bucketoutput_dir/ios/Assets.xcassets/AppIcon.appiconset/icon_<px>.pngfor each iOS sizeoutput_dir/icon_source.png— the 1024×1024 master
Returns :ok on success.
@spec ios_sizes() :: [pos_integer()]
Returns the list of iOS icon pixel dimensions.
@spec platforms(String.t()) :: [:android | :ios]
The platforms whose native project exists in project_dir (android/,
ios/). Icons are written only for these, so an --android project never
grows an ios/Assets.xcassets tree (and vice versa).
@spec platforms_missing_icons(String.t()) :: [:android | :ios]
The project's platforms that have no launcher icon yet. mix mob.install
writes its placeholder only to these, leaving existing (possibly custom)
icons alone.
@spec use_mob_logo(output_dir :: String.t(), [:android | :ios]) :: :ok
Copies the bundled Mob logo (pre-built PNGs) to the icon directories of
platforms (default: every platform the project has, platforms/1). Used
as the default placeholder icon by mix mob.install. No extra dependencies
or system tools required.
Returns :ok.