{"name":"User Interface Colors","title":"User Interface Colors","type":"topic","url":"https://community.bistudio.com/wiki/User_Interface_Colors","revid":346970,"updated":"2023-08-12T15:09:39Z","aliases":["Interface Colors"],"markdown":"Take On Helicopters introduced ability to recolor menu and HUD colors. Community creators can define new presets or use user's colors using following configs and functions.\n\n### Presets\n\nPresets are available for users in Options > Game Options > Interface Colors menu. Anybody can define new presets and categories.\n\n```\nclass CfgUIDefault // In Arma 3 the class was renamed to CfgUIColors\n{\n    // --- Tag\n    class IGUI\n    {\n        // --- Name displayed in menu\n        displayName = \"$STR_HSIM_CfgUIDefault_IGUI_0\";\n        // --- Color variables\n        class Variables\n        {\n            // --- Identification class ised by presets and scripts\n            class TEXT_RGB\n            {\n                // --- Name displayed in menu\n                displayName = \"$STR_HSIM_CfgUIDefault_IGUI_Variables_TEXT_RGB_0\";\n                // --- Preview picture background\n                previewBackground = \"\\hsim\\UI_H\\data\\loadscreen_generic_co.paa\";\n                // --- Preview picture (when 1 instead of String, whole menu is recolored instead)\n                preview = \"\\hsim\\UI_H\\data\\cursor_w_view_gs.paa\";\n                // --- Preview picture width\n                previewW = 4 * GUI_GRID_W;\n                // --- Preview picture height\n                previewH = 4 * GUI_GRID_H;\n            };\n        };\n        // --- Color presets\n        class Presets\n        {\n            class PresetDefault\n            {\n                // --- Name displayed in menu\n                displayName = \"$STR_HSIM_CfgUIDefault_IGUI_Presets_PresetGreen_0\";\n                // --- Class of modified variable (TEXT_RGB) with RGBA values\n                TEXT_RGB[] = {0,1,0.05,0.8};\n                // --- When 1, preset is used as default\n                default = 1;\n            };\n            class PresetBlue\n            {\n                displayName = \"$STR_HSIM_CfgUIDefault_IGUI_Presets_PresetDefault_0\";\n                TEXT_RGB[] = {0,1,1,0.8};\n            };\n        };\n    };\n};\n```\n\n### Macros\n\n#### Adding New\n\nSystem stores preset variables into profileNamespace upon startup. UI controls can link to them using getVariable command.\n\nUsing macros helps to keep the code simple and maintain it through development.\n\n```\n#define IGUI_TEXT_RGB_R    \"(profileNamespace getVariable ['IGUI_TEXT_RGB_R', 0])\"\n#define IGUI_TEXT_RGB_G    \"(profileNamespace getVariable ['IGUI_TEXT_RGB_G', 1])\"\n#define IGUI_TEXT_RGB_B    \"(profileNamespace getVariable ['IGUI_TEXT_RGB_B', 0.05])\"\n#define IGUI_TEXT_RGB_A    \"(profileNamespace getVariable ['IGUI_TEXT_RGB_A', 0.8])\"\n```\n\nExplanation:\n\n- **#define IGUI_TEXT_RGB_R** - macro name. Can be anything, but naming it based on preset is recommended.\n- **\"(profileNamespace getVariable ['IGUI_TEXT_RGB_R',0])\"** - actual value. Must be String, otherwise macro would be terminated after first comma (,)\n  - **IGUI_TEXT_RGB** - variable created by system based on preset. Created from <tag>_<variable>\n  - **0** - default value in case variable is not found (used on first game start)\n\n#### Existing\n\nColor macros are defined in *defineCommon.inc* (see User Interface Macros for more details). Following defines are based on user modifiable colors:\n\n- GUI (menus)\n  - **GUI_BCG_RGB** - menu background RGB\n  - **GUI_BCG_COLOR** - menu background RGBA\n  - **GUI_BCG_MEDIUM_RGB** - button background RGB (darker version of GUI_BCG_RGB)\n  - **GUI_BCG_MEDIUM_COLOR** - button background RGBA\n  - **GUI_BCG_ACTIVE_RGB** - active button background color (e.g. focused buttons) RGB\n- IGUI (HUD)\n  - **IGUI_TEXT_RGB** - HUD color RGB\n  - **IGUI_TEXT_COLOR** - HUD color RGBA\n\n#### Sample Configs\n\nSet text/picture color to HUD color\n\n```cpp\ncolorText[] = IGUI_TEXT_COLOR;\n```\n\nSet text/picture color to HUD color with fixed alpha (e.g. override user transparency settings)\n\n```cpp\ncolorText[] = { IGUI_TEXT_RGB, 1 };\n```\n\n### Functions\n\n- BIS_fnc_displayColorGet\n- BIS_fnc_displayColorSet","sections":[{"heading":null,"level":1,"markdown":"Take On Helicopters introduced ability to recolor menu and HUD colors. Community creators can define new presets or use user's colors using following configs and functions."},{"heading":"Presets","level":3,"markdown":"Presets are available for users in Options > Game Options > Interface Colors menu. Anybody can define new presets and categories.\n\n```\nclass CfgUIDefault // In Arma 3 the class was renamed to CfgUIColors\n{\n    // --- Tag\n    class IGUI\n    {\n        // --- Name displayed in menu\n        displayName = \"$STR_HSIM_CfgUIDefault_IGUI_0\";\n        // --- Color variables\n        class Variables\n        {\n            // --- Identification class ised by presets and scripts\n            class TEXT_RGB\n            {\n                // --- Name displayed in menu\n                displayName = \"$STR_HSIM_CfgUIDefault_IGUI_Variables_TEXT_RGB_0\";\n                // --- Preview picture background\n                previewBackground = \"\\hsim\\UI_H\\data\\loadscreen_generic_co.paa\";\n                // --- Preview picture (when 1 instead of String, whole menu is recolored instead)\n                preview = \"\\hsim\\UI_H\\data\\cursor_w_view_gs.paa\";\n                // --- Preview picture width\n                previewW = 4 * GUI_GRID_W;\n                // --- Preview picture height\n                previewH = 4 * GUI_GRID_H;\n            };\n        };\n        // --- Color presets\n        class Presets\n        {\n            class PresetDefault\n            {\n                // --- Name displayed in menu\n                displayName = \"$STR_HSIM_CfgUIDefault_IGUI_Presets_PresetGreen_0\";\n                // --- Class of modified variable (TEXT_RGB) with RGBA values\n                TEXT_RGB[] = {0,1,0.05,0.8};\n                // --- When 1, preset is used as default\n                default = 1;\n            };\n            class PresetBlue\n            {\n                displayName = \"$STR_HSIM_CfgUIDefault_IGUI_Presets_PresetDefault_0\";\n                TEXT_RGB[] = {0,1,1,0.8};\n            };\n        };\n    };\n};\n```"},{"heading":"Macros","level":3,"markdown":""},{"heading":"Adding New","level":4,"markdown":"System stores preset variables into profileNamespace upon startup. UI controls can link to them using getVariable command.\n\nUsing macros helps to keep the code simple and maintain it through development.\n\n```\n#define IGUI_TEXT_RGB_R    \"(profileNamespace getVariable ['IGUI_TEXT_RGB_R', 0])\"\n#define IGUI_TEXT_RGB_G    \"(profileNamespace getVariable ['IGUI_TEXT_RGB_G', 1])\"\n#define IGUI_TEXT_RGB_B    \"(profileNamespace getVariable ['IGUI_TEXT_RGB_B', 0.05])\"\n#define IGUI_TEXT_RGB_A    \"(profileNamespace getVariable ['IGUI_TEXT_RGB_A', 0.8])\"\n```\n\nExplanation:\n\n- **#define IGUI_TEXT_RGB_R** - macro name. Can be anything, but naming it based on preset is recommended.\n- **\"(profileNamespace getVariable ['IGUI_TEXT_RGB_R',0])\"** - actual value. Must be String, otherwise macro would be terminated after first comma (,)\n  - **IGUI_TEXT_RGB** - variable created by system based on preset. Created from <tag>_<variable>\n  - **0** - default value in case variable is not found (used on first game start)"},{"heading":"Existing","level":4,"markdown":"Color macros are defined in *defineCommon.inc* (see User Interface Macros for more details). Following defines are based on user modifiable colors:\n\n- GUI (menus)\n  - **GUI_BCG_RGB** - menu background RGB\n  - **GUI_BCG_COLOR** - menu background RGBA\n  - **GUI_BCG_MEDIUM_RGB** - button background RGB (darker version of GUI_BCG_RGB)\n  - **GUI_BCG_MEDIUM_COLOR** - button background RGBA\n  - **GUI_BCG_ACTIVE_RGB** - active button background color (e.g. focused buttons) RGB\n- IGUI (HUD)\n  - **IGUI_TEXT_RGB** - HUD color RGB\n  - **IGUI_TEXT_COLOR** - HUD color RGBA"},{"heading":"Sample Configs","level":4,"markdown":"Set text/picture color to HUD color\n\n```cpp\ncolorText[] = IGUI_TEXT_COLOR;\n```\n\nSet text/picture color to HUD color with fixed alpha (e.g. override user transparency settings)\n\n```cpp\ncolorText[] = { IGUI_TEXT_RGB, 1 };\n```"},{"heading":"Functions","level":3,"markdown":"- BIS_fnc_displayColorGet\n- BIS_fnc_displayColorSet"}],"categories":["GUI Topics","Take On Helicopters: Editing"],"groups":["GUI"]}