Skip to content
ModernUI A DaneTrades developer library

Icons and Images

ModernUI supports two built-in icon paths:

  1. Atlas icons — small pre-rendered PNG atlas icons used for the common built-in actions.
  2. Canvas icons — the original drawn icon path, used as fallback and for icons not included in the atlas.

You do not need to choose between them in normal code. Existing MUI_ICON_* values continue to work. When an icon is available in the atlas and the atlas images are installed, ModernUI draws the atlas icon. If the image files are missing or the icon is not mapped, ModernUI falls back to the canvas version.

Built-in atlas icons

The runtime atlas files are included in the package as:

Folder path
Images/ModernUI/ModernUI_Icons_16.png
Images/ModernUI/ModernUI_Icons_20.png
Images/ModernUI/ModernUI_Icons_24.png

The atlas definitions live in:

File path
Include/ModernUI/Assets/IconAtlas.mqh
Include/ModernUI/Assets/IconAtlasDefs.mqh

The PNG files are white alpha-mask icons. ModernUI uses the icon alpha as a mask and applies the current theme/state colour at draw time.

This lets the same atlas icon appear as:

  • normal text colour
  • muted text colour
  • accent colour
  • warning/danger/success colour when a control asks for it
  • disabled low-contrast colour

Manual install path

If you install ModernUI manually, copy the image assets into:

Folder path
MQL5/Images/ModernUI/

After copying, these files should exist:

File path
MQL5/Images/ModernUI/ModernUI_Icons_16.png
MQL5/Images/ModernUI/ModernUI_Icons_20.png
MQL5/Images/ModernUI/ModernUI_Icons_24.png

The package examples still compile if these files are missing. The icons simply fall back to the canvas renderer.

Icon buttons

Use Mui::IconButton for a compact icon-only action.

UI build fragment
MuiButtonAction *settings=Mui::IconButton(parent,MUI_ICON_SETTINGS);
settings.Id(PANEL_ACTION_SETTINGS);

size == 0.0 uses the theme icon button size. The default glyph size is tuned for compact MT5 panels: normal buttons use a readable icon size, dense mode uses a smaller compact size where appropriate.

For an icon with text:

UI build fragment
MuiButtonAction *refresh=Mui::ButtonIcon(parent,MUI_ICON_REFRESH,"Refresh",NULL,170.0,0.0);
refresh.Id(PANEL_ACTION_REFRESH);

Common mapped icons

The atlas covers the common UI actions used in panels and toolbars, including:

Group Examples
Basic actions plus, minus, close, check
Navigation chevrons, arrows, menu, list
Editing edit, copy, delete, save
Tools settings, search, filter, refresh
Status warning, info, lock, unlock, clock
Files/data folder, download, upload
Dashboard chart line, chart bar, account/user, risk/shield

Icons not in the atlas continue to use the existing canvas path.

Fallback behaviour

If Images/ModernUI is not installed:

  • the UI does not crash
  • ModernUI logs at most one warning per missing atlas size when logging allows warnings
  • existing canvas icons are drawn instead
  • controls remain usable

This is intentional. The atlas improves polish, but it is not a hard dependency for compiling or running basic panels.

Performance notes

Atlas PNGs are loaded lazily. Each atlas size is loaded once, then reused from memory.

There is no PNG file loading or decoding on every paint. Drawing an atlas icon reads the cached pixel data and applies the requested tint colour.

The three decoded atlases are small. The current atlas sizes are:

Atlas Dimensions
16px 200 × 100
20px 240 × 120
24px 280 × 140

All three together are only a few hundred KiB of decoded pixel data, before small array overhead.

Regenerating the atlas

The source SVG selection and generator live outside the runtime include tree:

Folder path
tools/modernui_icons/

The generator creates:

Folder path
tools/modernui_icons/output/ModernUI_Icons_16.png
tools/modernui_icons/output/ModernUI_Icons_20.png
tools/modernui_icons/output/ModernUI_Icons_24.png
tools/modernui_icons/output/IconAtlasDefs.mqh

Generated atlas IDs use MUI_ATLAS_ID_* names internally so they do not clash with public MUI_ICON_* values.

Do not ship node_modules, selected SVGs, or Python tooling as runtime package files.

Third-party notice

The built-in atlas is generated from Tabler Icons. The package includes a Tabler Icons third-party notice under the offline docs. Keep that notice with release packages.

Common mistakes

Forgetting the Images folder

If atlas icons do not appear, check that MQL5/Images/ModernUI/ contains the three PNG files.

The UI will still work without them because canvas fallback is available.

Expecting every MUI_ICON_* to be atlas-backed

Only the curated core icon set is in the atlas. Less common icons may still be drawn by the canvas icon path.

Editing generated atlas definitions manually

If the icon list changes, regenerate the atlas and IconAtlasDefs.mqh from the tooling folder rather than editing slot coordinates by hand.

Related pages