UKismetStringLibrary::Conv_StringToColor
#include "Kismet/KismetStringLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Parses a string in the '(R=,G=,B=,A=)' format back into an FLinearColor, reporting whether parsing succeeded via OutIsValid.
Caveats & Gotchas
- • Uses FLinearColor::InitFromString, which parses each channel independently — a string missing the alpha component, for example, can still report success while leaving that channel at whatever value OutConvertedColor previously held.
- • The parsed color is linear, not sRGB, so if the source string came from a color picker's displayed values rather than Conv_ColorToString's output, the result won't match what was shown on screen.
Signature
static void Conv_StringToColor(const FString& InString, FLinearColor& OutConvertedColor, bool& OutIsValid) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InString | const FString& | The string to parse, expected in the '(R=,G=,B=,A=)' format. | — |
| OutConvertedColor | FLinearColor& | The parsed linear color value; only meaningful when OutIsValid is true. | — |
| OutIsValid | bool& | True if InString was successfully parsed into a color. | — |
Return Type
void Example
Restore a saved tint color from a string C++
FString ColorText = TEXT("(R=0.200000,G=0.400000,B=0.800000,A=1.000000)");
FLinearColor TintColor;
bool bIsValid = false;
UKismetStringLibrary::Conv_StringToColor(ColorText, TintColor, bIsValid); Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?