Panel Theme Engine
Most hand-built dashboards end up with each panel choosing its own background, border and text colours ad hoc, so a "dark mode" toggle means hunting down every ObjectSetInteger(...,COLOR,...) call across a dozen files. This library defines one plain colour struct (background, panel, border, text, muted text, accent, positive, negative) with a dark and a light preset built in, plus a one-line way to start a custom palette from either preset. Applying a theme to a group of objects means knowing which colour property each object type actually uses - a filled rectangle/button wants OBJPROP_BGCOLOR, a label wants OBJPROP_COLOR - so ApplyToPrefix() inspects each matching object's OBJPROP_TYPE at apply time and routes it to the right property automatically. An optional accented-suffix list lets one call retheme an entire panel while still highlighting the one active tab or button with the theme's accent colour instead of its ordinary panel colour. Notes and limitations - SPanelTheme is a plain fixed-field struct with no dynamic members, so ordinary copy/assignment ('=') and pass-by-value both behave exactly as expected in MQL4 - no deep-copy helper is needed. - ApplyToObject/ApplyToPrefix cover OBJ_RECTANGLE_LABEL, OBJ_BUTTON and OBJ_EDIT as "filled" objects and treat everything else (labels, lines, text) as foreground-coloured; an object type with a genuinely different colour model may need manual styling on top. - accentedSuffixes is a mandatory array parameter, not an optional one - MQL4 disallows default values on array-reference parameters. Pass an empty-length array if no accented objects are needed. - No money is at risk in the demo. It only creates and recolours sample chart objects and never sends an order.
Script · MT4 · v1.0 · Free
About Panel Theme Engine
Panel Theme Engine is a script for MetaTrader 4. MQL source code included.
Files in the download: PanelThemeEngine.mqh, PanelThemeEngine.txt, PanelThemeEngineDemo.mq4.
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Dashboards & Scanners · MT4 Script · MQL4 Source Code