This function was initialy created as a helper function in my other recent UDF (_GUICtrlCreateTFLabel), but after searching on the forum for such function and not finding anything like this (i was surprised actualy, i thought this kind of function could be posted long time ago), i think that i should post it here.
The colors table i got from here.
In the archive with _ColorConvertValue there is also a parser script that i used to generate the table for UDF usage.
Function Header:
; #FUNCTION# ======================================================================================== ; Name...........: _ColorConvertValue ; Description....: Converts string color value to hex and back. ; Syntax.........: _ColorConvertValue($sColor, $iConvertMode=-1, $aColors_Table=0) ; Parameters.....: $sColor - Color name or color hex value, depending on $iConvertMode. ; $iConvertMode - [Optional] If this parameter <> -1, then the function will convert hex color to string value ; (default is -1 - convert from string to hex). ; $aDefColorsTable - [Optional] If this parameter will contain an array with colors table (default is 0), ; then this colors table will be used to convert the color. ; ; Return values..: Success - Returns converted color value. ; Failure - Returns original $sColor value (if the color can not be converted). ; Author.........: G.Sandler (MrCreatoR) ; Modified.......: 21.06.2009 ; Remarks........: ; Related........: ; Link...........: Colors table used in this function: http://ilan.belhost.by/screens/colorx.shtml ; Example........: Yes. ; ===================================================================================================
For example:
Attachments:Blue converted to 0x0000FF
Red converted to 0xFF0000
and back...
0x0000FF to Blue
0xFF0000 to Red
v1.1
_ColorConvertValue.zip 2.9K
144 downloadsv1.0
_ColorConvertValue.zip 2.69K
89 downloadsEdited by MrCreatoR, 20 June 2009 - 11:34 PM.












