HexToRGBAFloat: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
No edit summary
 
Line 1: Line 1:
{{Info|Function|Server & Client|1.0}}
{{Info|Function|Server & Client|1.0}}


{{FuncDescription|Converts Hex color value into RGBA float}}
{{FuncDescription|Converts Hex color value into RGBA float. Useful for FLinearColor.}}


{{FuncSyntax|HexToRGBAFloat(HexColor)}}
{{FuncSyntax|HexToRGBAFloat(HexColor)}}
Line 8: Line 8:
{{FuncParam|HexColor|Hex color in float format.}}
{{FuncParam|HexColor|Hex color in float format.}}


{{FuncReturnValue|R, G, B, A values between 0 and 255}}
{{FuncReturnValue|R, G, B, A values between 0.0 and 1.0}}


== Example ==
== Example ==
<syntaxhighlight lang="Lua">
<syntaxhighlight lang="Lua">
function convertColor(hex)
function convertToFLinearColor(hex)
     return r, g, b, a = HexToRGBAFloat(hex)
     local r, g, b, a = HexToRGBAFloat(hex)
    return FLinearColor(r, g, b, a)
end
end
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 14:21, 23 November 2019

HexToRGBAFloat

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Converts Hex color value into RGBA float. Useful for FLinearColor.

Syntax

HexToRGBAFloat(HexColor)

Parameters

  • HexColor
    Hex color in float format.

Return Value

  • R, G, B, A values between 0.0 and 1.0

Example

function convertToFLinearColor(hex)
    local r, g, b, a = HexToRGBAFloat(hex)
    return FLinearColor(r, g, b, a)
end

See also