UKismetMathLibrary::ToHex_LinearColor
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Converts a linear color to an uppercase 8-character hex string in RRGGBBAA format by first quantising to 8-bit per channel. Useful for serialization, debugging, and CSS-style color output.
Caveats & Gotchas
- • The conversion clamps each channel to [0,1] before quantising to 8-bit — HDR channel values above 1.0 will be silently clamped to FF, losing HDR information.
- • The output is RRGGBBAA (alpha last), not AARRGGBB — this differs from the FColor constructor format used in some other UE APIs.
Signature
static UE_INL_API FString ToHex_LinearColor(FLinearColor InColor); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InColor | FLinearColor | Linear color to convert. | — |
Return Type
FString Example
Log a color for debugging C++
FLinearColor Color = FLinearColor(0.f, 0.502f, 1.f, 1.f);
FString Hex = UKismetMathLibrary::ToHex_LinearColor(Color);
UE_LOG(LogTemp, Log, TEXT("Color hex: %s"), *Hex); // e.g. "0080FFFF" Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?