Mega UI
Icons
The fourteen built-in icons, and how to ship your own PNG so it does not come out the wrong colour.
Built-in icons
Cheapest option, and it keeps your app looking like it belongs on the desktop. Pass the name; an
unknown name falls back to monitor rather than leaving your app blank.
Icon = UiIcon.Builtin("package"),These are the exact images the library draws, rendered here from the same files:
Icons by Lucide, ISC License.
All three ship the identical set under identical names, so an icon choice copied between them keeps the same picture without you checking anything.
You can also list them at runtime, which is handy if you are writing a tool:
foreach (string name in MegaUiApi.BuiltinIcons) { /* ... */ }Your own PNG
Icon = UiIcon.FromPng(MyIcons.Report),| Requirement | Value |
|---|---|
| Format | PNG, with transparency |
| Size | 128×128 is what the built-ins use. Bigger is fine, square is what matters. |
| Shape | Square. A wide image is letterboxed, never stretched. |
| Delivery | byte[] — embed it, do not read a file path |
A file path only exists on the machine that built your mod. Embed the PNG in your assembly (or paste it as base64 in a static field) and hand over the bytes.
Colour: the trap
The desktop icon you get is a clone of a native button, and the game's own button may
carry a tint on its Image. Image.color multiplies the
sprite, so an inherited tint would repaint your art in a colour nobody chose.
Mega UI forces the tint back to white before applying your sprite. The consequence for you: your PNG is drawn exactly as you made it, so ship it in the colours you want to see. A white silhouette stays white; a colourful logo stays colourful.
When an icon fails to load
Nothing disappears. The order is:
- Your PNG, if it decodes
- The built-in you named
monitor, the generic one
A PNG that fails to decode is logged once and remembered, so a broken image does not get retried
on every repaint. Search the log for [ui] and your guid.
An app with no icon is an app the player cannot find. Falling back twice is cheaper than one support thread that starts with "the mod does not appear".