Arma 3 Scripting

User Interface Colors

  • Also known as Interface Colors

Topic · Markdown · JSON · original wiki page

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.

Presets

Presets are available for users in Options > Game Options > Interface Colors menu. Anybody can define new presets and categories.

class CfgUIDefault // In Arma 3 the class was renamed to CfgUIColors
{
    // --- Tag
    class IGUI
    {
        // --- Name displayed in menu
        displayName = "$STR_HSIM_CfgUIDefault_IGUI_0";
        // --- Color variables
        class Variables
        {
            // --- Identification class ised by presets and scripts
            class TEXT_RGB
            {
                // --- Name displayed in menu
                displayName = "$STR_HSIM_CfgUIDefault_IGUI_Variables_TEXT_RGB_0";
                // --- Preview picture background
                previewBackground = "\hsim\UI_H\data\loadscreen_generic_co.paa";
                // --- Preview picture (when 1 instead of String, whole menu is recolored instead)
                preview = "\hsim\UI_H\data\cursor_w_view_gs.paa";
                // --- Preview picture width
                previewW = 4 * GUI_GRID_W;
                // --- Preview picture height
                previewH = 4 * GUI_GRID_H;
            };
        };
        // --- Color presets
        class Presets
        {
            class PresetDefault
            {
                // --- Name displayed in menu
                displayName = "$STR_HSIM_CfgUIDefault_IGUI_Presets_PresetGreen_0";
                // --- Class of modified variable (TEXT_RGB) with RGBA values
                TEXT_RGB[] = {0,1,0.05,0.8};
                // --- When 1, preset is used as default
                default = 1;
            };
            class PresetBlue
            {
                displayName = "$STR_HSIM_CfgUIDefault_IGUI_Presets_PresetDefault_0";
                TEXT_RGB[] = {0,1,1,0.8};
            };
        };
    };
};

Macros

Adding New

System stores preset variables into profileNamespace upon startup. UI controls can link to them using getVariable command.

Using macros helps to keep the code simple and maintain it through development.

#define IGUI_TEXT_RGB_R    "(profileNamespace getVariable ['IGUI_TEXT_RGB_R', 0])"
#define IGUI_TEXT_RGB_G    "(profileNamespace getVariable ['IGUI_TEXT_RGB_G', 1])"
#define IGUI_TEXT_RGB_B    "(profileNamespace getVariable ['IGUI_TEXT_RGB_B', 0.05])"
#define IGUI_TEXT_RGB_A    "(profileNamespace getVariable ['IGUI_TEXT_RGB_A', 0.8])"

Explanation:

Existing

Color macros are defined in defineCommon.inc (see User Interface Macros for more details). Following defines are based on user modifiable colors:

Sample Configs

Set text/picture color to HUD color

colorText[] = IGUI_TEXT_COLOR;

Set text/picture color to HUD color with fixed alpha (e.g. override user transparency settings)

colorText[] = { IGUI_TEXT_RGB, 1 };

Functions