• Diese Funktion zeigt wie man HEX to RGB manuell berechnen kann.
    Ansonsten bitte die _ColorGetRGB (EN) / _ColorGetRGB (DE) Funktion verwenden.


    [autoit]

    Func hex2rgb($clr)
    $h = StringInStr($clr, "0x") ? $clr : (StringInStr($clr, "#") ? "0x" & StringMid($clr, 2) : "0x" & $clr)
    Return BitShift(BitAnd($h, 0xff0000), 16) & "," & BitShift(BitAnd($h, 0xff00), 8) & "," & BitAnd($h, 0xff)
    EndFunc

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    MsgBox(0, "hex2rgb", hex2rgb("0x77c8d2") & @CRLF & hex2rgb("#77c8d2") & @CRLF & hex2rgb("77c8d2")) ; ==> 119,200,210

    [/autoit]

    oder

    [autoit]

    Func hex2rgb($clr)
    $h = StringInStr($clr, "0x") ? $clr : (StringInStr($clr, "#") ? "0x" & StringMid($clr, 2) : "0x" & $clr)
    Return BitAnd($h / 65536, 255) & "," & BitAnd($h / 256, 255) & "," & BitAnd($h, 255)
    EndFunc

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    MsgBox(0, "hex2rgb", hex2rgb("0x77c8d2") & @CRLF & hex2rgb("#77c8d2") & @CRLF & hex2rgb("77c8d2")) ; ==> 119,200,210

    [/autoit]


    Verwendet werden können: 0x?????? | #?????? | ??????
    Beispielergebnis:

    Code
    0x77c8d2  ==>  119,200,210
     #77c8d2  ==>  119,200,210
      77c8d2  ==>  119,200,210

    Einmal editiert, zuletzt von kaesereibe (24. Juli 2014 um 14:17)