iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🎨

[C++ & BP Column] Handling Colors: FLinearColor and FColor

に公開

The VariableType for TextColor in the PrintString Node is Linear Color Structure

Specifying Colors by Name

const FLinearColor TextColor = FLinearColor::White;
// A way to set White to an FLinearColor variable
// Specifying a color by name
const FLinearColor TextColor = FLinearColor::White;
const FLinearColor TextColor = FLinearColor::Black;


// FColor can also be used as an FLinearColor
// Specifying a color by name
const FLinearColor TextColor = FColor::White;
const FLinearColor TextColor = FColor::Black;

Where color types are defined:
\Epic Games\UE_5.0EA\Engine\Source\Runtime\Core\Private\MathColor.cpp

Specifying Colors by Numerical Values

// For FLinearColor, specify values from 0.0f to 1.0f
const FLinearColor TextColor = FLinearColor(1.0f, 1.0f, 1.0f); // All 1.0f results in white
const FLinearColor TextColor = FLinearColor(0.0f, 0.0f, 0.0f); // All 0.0f results in black

// For FColor, specify values from 0 to 255
const FLinearColor TextColor = FColor(255, 255, 255); // All 255 results in white
const FLinearColor TextColor = FColor(0, 0, 0); // All 0 results in black

Discussion