unreal.LinearColor

class unreal.LinearColor(r=0.0, g=0.0, b=0.0, a=0.0)

Bases: unreal.StructBase

A linear, 32-bit/component floating point RGBA color. The full C++ class is located here: EngineSourceRuntimeCorePublicMathColor.h:

C++ Source:

  • Module: CoreUObject
  • File: NoExportTypes.h

Editor Properties: (see get_editor_property/set_editor_property)

  • a (float): [Read-Write] A
  • b (float): [Read-Write] B
  • g (float): [Read-Write] G
  • r (float): [Read-Write] R
BLACK = None

(LinearColor) – Black linear color

BLUE = None

(LinearColor) – Blue linear color

GRAY = None

(LinearColor) – Grey linear color

GREEN = None

(LinearColor) – Green linear color

RED = None

(LinearColor) – Red linear color

TANSPARENT = None

(LinearColor) – Transparent linear color - black with 0 opacity/alpha

WHITE = None

(LinearColor) – White linear color

YELLOW = None

(LinearColor) – Yellow linear color

__add__(other)

Overloads:

  • LinearColor Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)
__div__(other)

Overloads:

  • LinearColor Element-wise multiplication of two linear colors (R/R, G/G, B/B, A/A)
__eq__(other)

Overloads:

  • LinearColor Returns true if linear color A is equal to linear color B (A == B) within a specified error tolerance
  • LinearColor Returns true if linear color A is equal to linear color B (A == B) within a specified error tolerance
__iadd__(other)

Overloads:

  • LinearColor Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)
__idiv__(other)

Overloads:

  • LinearColor Element-wise multiplication of two linear colors (R/R, G/G, B/B, A/A)
__imul__(other)

Overloads:

  • LinearColor Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)
__isub__(other)

Overloads:

  • LinearColor Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)
__mul__(other)

Overloads:

  • LinearColor Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)
__ne__(other)

Overloads:

  • LinearColor Returns true if linear color A is not equal to linear color B (A != B) within a specified error tolerance
__sub__(other)

Overloads:

  • LinearColor Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)
a

(float) – [Read-Write] A

add(b) → LinearColor

Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)

Parameters:b (LinearColor) –
Returns:
Return type:LinearColor
b

(float) – [Read-Write] B

desaturated(desaturation) → LinearColor

Returns a desaturated color, with 0 meaning no desaturation and 1 == full desaturation

Parameters:desaturation (float) –
Returns:Desaturated color
Return type:LinearColor
distance(c2) → float

Euclidean distance between two color points.

Parameters:c2 (LinearColor) –
Returns:
Return type:float
divide(b) → LinearColor

Element-wise multiplication of two linear colors (R/R, G/G, B/B, A/A)

Parameters:b (LinearColor) –
Returns:
Return type:LinearColor
equals(b) → bool

Returns true if linear color A is equal to linear color B (A == B) within a specified error tolerance

Parameters:b (LinearColor) –
Returns:
Return type:bool
g

(float) – [Read-Write] G

get_luminance() → float

Returns the perceived brightness of a color on a display taking into account the impact on the human eye per color channel: green > red > blue.

Returns:
Return type:float
get_max() → float

Returns the maximum color channel value in this color structure

Returns:The maximum color channel value
Return type:float
get_min() → float

Returns the minimum color channel value in this color structure

Returns:The minimum color channel value
Return type:float
hsv_into_rgb() → LinearColor

Converts a HSV linear color (where H is in R (0..360), S is in G (0..1), and V is in B (0..1)) to RGB

Returns:rgb (LinearColor):
Return type:LinearColor
hsv_to_rgb() → LinearColor

Converts a HSV linear color (where H is in R, S is in G, and V is in B) to linear RGB

Returns:
Return type:LinearColor
interpolate_to(target, delta_time, interp_speed) → LinearColor

Interpolate Linear Color from Current to Target. Scaled by distance to Target, so it has a strong start speed and ease out.

Parameters:
  • target (LinearColor) – Target Color
  • delta_time (float) – Time since last tick
  • interp_speed (float) – Interpolation speed
Returns:

New interpolated Color

Return type:

LinearColor

is_near_equal(b, tolerance=0.000100) → bool

Returns true if linear color A is equal to linear color B (A == B) within a specified error tolerance

Parameters:
Returns:

Return type:

bool

lerp_to(b, alpha) → LinearColor

Linearly interpolates between A and B based on Alpha (100% of A when Alpha=0 and 100% of B when Alpha=1)

Parameters:
Returns:

Return type:

LinearColor

lerp_using_hsv_to(b, alpha) → LinearColor

Linearly interpolates between two colors by the specified Alpha amount (100% of A when Alpha=0 and 100% of B when Alpha=1). The interpolation is performed in HSV color space taking the shortest path to the new color’s hue. This can give better results than a normal lerp, but is much more expensive. The incoming colors are in RGB space, and the output color will be RGB. The alpha value will also be interpolated.

Parameters:
  • b (LinearColor) – The color and alpha to interpolate to as linear RGBA
  • alpha (float) – Scalar interpolation amount (usually between 0.0 and 1.0 inclusive)
Returns:

The interpolated color in linear RGB space along with the interpolated alpha value

Return type:

LinearColor

multiply(b) → LinearColor

Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)

Parameters:b (LinearColor) –
Returns:
Return type:LinearColor
multiply_float(b) → LinearColor

Element-wise multiplication of a linear color by a float (F*R, F*G, F*B, F*A)

Parameters:b (float) –
Returns:
Return type:LinearColor
not_equal(b) → bool

Returns true if linear color A is not equal to linear color B (A != B) within a specified error tolerance

Parameters:b (LinearColor) –
Returns:
Return type:bool
quantize() → Color

Quantizes the linear color and returns the result as an 8-bit color. This bypasses the SRGB conversion.

Returns:
Return type:Color
quantize_round() → Color

Quantizes the linear color with rounding and returns the result as an 8-bit color. This bypasses the SRGB conversion.

Returns:
Return type:Color
r

(float) – [Read-Write] R

rgb_into_hsv() → LinearColor

Converts a RGB linear color to HSV (where H is in R (0..360), S is in G (0..1), and V is in B (0..1))

Returns:hsv (LinearColor):
Return type:LinearColor
rgb_into_hsv_components() -> (h=float, s=float, v=float, a=float)

Breaks apart a color into individual HSV components (as well as alpha) (Hue is [0..360) while Saturation and Value are 0..1)

Returns:h (float):

s (float):

v (float):

a (float):

Return type:tuple
rgb_to_hsv() → LinearColor

Converts a RGB linear color to HSV (where H is in R, S is in G, and V is in B)

Returns:
Return type:LinearColor
set(color) → None

Assign contents of InColor

Parameters:color (LinearColor) –
set_from_hsv(h, s, v, a=1.000000) → None

Assigns an HSV color to a linear space RGB color

Parameters:
set_from_pow22(color) → None

Assigns an FColor coming from an observed Pow(1/2.2) output, into a linear color.

Parameters:color (Color) – The Pow(1/2.2) color that needs to be converted into linear space.
set_from_srgb(srgb) → None

Assigns an FColor coming from an observed sRGB output, into a linear color.

Parameters:srgb (Color) – The sRGB color that needs to be converted into linear space.
set_random_hue() → None

Sets to a random color. Choses a quite nice color based on a random hue.

set_rgba(r, g, b, a=1.000000) → None

Assign individual linear RGBA components.

Parameters:
set_temperature(temperature) → None

Converts temperature in Kelvins of a black body radiator to RGB chromaticity.

Parameters:temperature (float) –
subtract(b) → LinearColor

Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)

Parameters:b (LinearColor) –
Returns:
Return type:LinearColor
to_color(use_srgb=True) → Color

Quantizes the linear color and returns the result as a FColor with optional sRGB conversion and quality as goal.

Parameters:use_srgb (bool) –
Returns:
Return type:Color
to_new_opacity(opacity) → LinearColor

Returns a copy of this color using the specified opacity/alpha.

Parameters:opacity (float) –
Returns:
Return type:LinearColor
to_rgb_vector() → Vector

Converts a LinearColor to a vector

Returns:
Return type:Vector
to_rgbe() → Color

Convert from linear to 8-bit RGBE as outlined in Gregory Ward’s Real Pixels article, Graphics Gems II, page 80.

Returns:
Return type:Color