I’m of the mind that 5.3’s C++ systems for converting Hex strings to FColor are all broken. Can you the community check my insanity please and tell me where I’ve gone wrong as I’m trying to not fight the engine.
Using various online converters as well as photoshop, "FED80DFF"
converts to R=254, G=216, B=13, A=255
However in UE each conversion I found results in erroneous values.
//Examples both with and without the leading "#"
FString strHexWith = TEXT("#FED80DFF");
FString strHexWithout = TEXT("FED80DFF");
FString str;
FColor colorA;
colorA.FromHex(strHexWith);
str = colorA.ToString();
UE_LOG(LogTemp, Log, TEXT("%s"), *str);
//LogTemp: (R=137,G=125,B=0,A=241) <- INCORRECT
FColor colorB;
colorB.FromHex(*strHexWithout);
str = colorB.ToString();
UE_LOG(LogTemp, Log, TEXT("%s"), *str);
//LogTemp: (R=0,G=8,B=197,A=0) <- INCORRECT
int32 intValA = FParse::HexDigit(**strHexWith);
FColor colorC = FColor(intValA);
str = colorC.ToString();
UE_LOG(LogTemp, Log, TEXT("%s"), *str);
//LogTemp: (R=0,G=0,B=0,A=0) <- INCORRECT
int32 intValB = FParse::HexDigit(**strHexWithout);
FColor colorD = FColor(intValB);
str = colorD.ToString();
UE_LOG(LogTemp, Log, TEXT("%s"), *str);
//LogTemp: (R=0,G=0,B=15,A=0) <- INCORRECT
uint32 uintValA = FParse::HexNumber(*strHexWith);
FColor colorE = FColor(uintValA);
str = colorE.ToString();
UE_LOG(LogTemp, Log, TEXT("%s"), *str);
//LogTemp: (R=216,G=13,B=255,A=254) <- Incorrect Order
uint32 uintValB = FParse::HexNumber(*strHexWithout);
FColor colorF = FColor(uintValB);
str = colorF.ToString();
UE_LOG(LogTemp, Log, TEXT("%s"), *str);
//LogTemp: (R=216,G=13,B=255,A=254) <- Incorrect Order