RealDocs

UKismetMathLibrary::LinearColor_Desaturated

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Returns a copy of the color linearly interpolated toward its luminance-equivalent grey by the given desaturation factor. Useful for hit-flash effects, disabled-state UI tinting, or environmental mood changes.

Caveats & Gotchas

  • The grey target is computed using perceptual luminance weights (the same as LinearColor_GetLuminance), not a simple (R+G+B)/3 average. Desaturating to 1.0 gives the perceptually correct grey, not an arithmetic mean.
  • InDesaturation is not clamped internally — passing values outside [0, 1] extrapolates beyond the original color and grey, potentially producing negative or > 1.0 channel values.

Signature

static UE_INL_API FLinearColor LinearColor_Desaturated(FLinearColor InColor, float InDesaturation)

Parameters

Name Type Description Default
InColor FLinearColor The source linear color to desaturate.
InDesaturation float Amount of desaturation in [0.0, 1.0]. 0 = original color, 1 = fully grey.

Return Type

FLinearColor

Example

Fade a color to grey when an ability is on cooldown C++
float CooldownRatio = RemainingCooldown / TotalCooldown; // 0 = ready, 1 = full cooldown
FLinearColor IconColor = UKismetMathLibrary::LinearColor_Desaturated(BaseColor, CooldownRatio);
AbilityIcon->SetColorAndOpacity(IconColor);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.