Jump to content
cybercoco

Specify color transparency

Recommended Posts

Is there a way to make a color transparent. I am using this http://killzonekid.com/hex-2-arma-gui-colour-converter/ to convert from Hex to ingame color code.

However I can't find a way to convert rgba colors (which hold a transparency value) like this one (168, 168, 168, 0.66).

 

Thanks in advance,

 

C.Coco

Share this post


Link to post
Share on other sites

fnc_hexToColorArray = {

    params[ "_color" ];

    _hexArray = toArray toUpper _color;

    {

        _hexArray set [ _forEachIndex, toString [ _x ] ];

    }forEach _hexArray;

    

    if ( _hexarray select 0 isEqualTo "#" ) then {

        _nul = _hexArray deleteAt 0;

    };

    

    _hex = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" ];

    

    _value = [];

    for "_i" from 0 to ( count _hexArray ) -1 step 2 do {

        _nul = _value pushBack ( [ ((( _hex find ( _hexArray select _i )) * 16 ) + ( _hex find ( _hexArray select ( _i + 1 )))) / 255, 3 ] call BIS_fnc_cutDecimals );

    };

    

    _value

};

 

"#FFFFFFFF" call fnc_hexToColorArray;

fnc_rgbaToColorArray = {

_color = _this;

for "_i" from 0 to 2 do {

if !( _color select _i isEqualTo 0 ) then {

_color set [ _i, ( _color select _i ) / 255 ];

};

};

_color

};

[ 168, 168, 168, 0.66 ] call fnc_rgbaToColorArray;

EDIT: Sorry think i misread the question ^^^

Share this post


Link to post
Share on other sites

So, do I use this function "fnc_rgbaToColorArray" ?

Share this post


Link to post
Share on other sites

The two functions are working perfectly ! Thank you !

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×