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.

csharp
Icon = UiIcon.Builtin("package"),

These are the exact images the library draws, rendered here from the same files:

chevrons-right chevrons-right
footprints footprints
gauge gauge
git-branch git-branch
hand hand
monitor monitor
package package
scan-barcode scan-barcode
shopping-cart shopping-cart
timer timer
truck truck
user-plus user-plus
users users
zap zap

Icons by Lucide, ISC License.

The same names as Mega Tree and Tech Tree

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:

csharp
foreach (string name in MegaUiApi.BuiltinIcons) { /* ... */ }

Your own PNG

csharp
Icon = UiIcon.FromPng(MyIcons.Report),
RequirementValue
FormatPNG, with transparency
Size128×128 is what the built-ins use. Bigger is fine, square is what matters.
ShapeSquare. A wide image is letterboxed, never stretched.
Deliverybyte[] — embed it, do not read a file path
Bytes, not a 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:

  1. Your PNG, if it decodes
  2. The built-in you named
  3. 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.

Why an icon never falls back to nothing

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".