Class ColorHelpers
Class containing various methods for manipulating colors.
Assembly: Dalamud.dll
View Source
public static class ColorHelpers
Methods
RgbaVector4ToUint(Vector4)
Pack a vector4 color into a uint for use in ImGui APIs.
View Source
public static uint RgbaVector4ToUint(Vector4 color)
Returns
System.UInt32
: The packed color.
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.Vector4 | color | The color to pack. |
RgbaUintToVector4(uint)
Convert a RGBA color in the range of 0.f to 1.f to a uint.
View Source
public static Vector4 RgbaUintToVector4(uint color)
Returns
System.Numerics.Vector4
: The packed color.
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | color | The color to pack. |
RgbaToHsv(Vector4)
Convert a RGBA color in the range of 0.f to 1.f to a HSV color.
View Source
public static ColorHelpers.HsvaColor RgbaToHsv(Vector4 color)
Returns
Dalamud.Interface.ColorHelpers.HsvaColor: The color in a HSV representation.
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.Vector4 | color | The color to convert. |
HsvToRgb(HsvaColor)
Convert a HSV color to a RGBA color in the range of 0.f to 1.f.
View Source
public static Vector4 HsvToRgb(ColorHelpers.HsvaColor hsv)
Returns
System.Numerics.Vector4
: The RGB color.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.ColorHelpers.HsvaColor | hsv | The color to convert. |
SwapEndianness(uint)
Performs a swap of endianness Exmaple: (FFXIV) RGBA to ABGR (ImGui).
View Source
public static uint SwapEndianness(uint rgba)
Returns
System.UInt32
: Endian swapped color value with new byte order W Z Y X.
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | rgba | Color value in byte order X Y Z W. |
Lighten(Vector4, float)
Lighten a color.
View Source
public static Vector4 Lighten(this Vector4 color, float amount)
Returns
System.Numerics.Vector4
: The lightened color.
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.Vector4 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
Lighten(uint, float)
Lighten a color.
View Source
public static uint Lighten(uint color, float amount)
Returns
System.UInt32
: The lightened color.
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
Darken(Vector4, float)
Darken a color.
View Source
public static Vector4 Darken(this Vector4 color, float amount)
Returns
System.Numerics.Vector4
: The darkened color.
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.Vector4 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
Darken(uint, float)
Darken a color.
View Source
public static uint Darken(uint color, float amount)
Returns
System.UInt32
: The darkened color.
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
Saturate(Vector4, float)
Saturate a color.
View Source
public static Vector4 Saturate(this Vector4 color, float amount)
Returns
System.Numerics.Vector4
: The saturated color.
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.Vector4 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
Saturate(uint, float)
Saturate a color.
View Source
public static uint Saturate(uint color, float amount)
Returns
System.UInt32
: The saturated color.
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
Desaturate(Vector4, float)
Desaturate a color.
View Source
public static Vector4 Desaturate(this Vector4 color, float amount)
Returns
System.Numerics.Vector4
: The desaturated color.
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.Vector4 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
Desaturate(uint, float)
Desaturate a color.
View Source
public static uint Desaturate(uint color, float amount)
Returns
System.UInt32
: The desaturated color.
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
ApplyOpacity(uint, float)
Applies the given opacity value ranging from 0 to 1 to an uint value containing a RGBA value.
View Source
public static uint ApplyOpacity(uint rgba, float opacity)
Returns
System.UInt32
: Transformed value.
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | rgba | RGBA value to transform. |
System.Single | opacity | Opacity to apply. |
SwapRedBlue(uint)
Swaps red and blue channels of a given color in ARGB(BB GG RR AA) and ABGR(RR GG BB AA).
View Source
public static uint SwapRedBlue(uint x)
Returns
System.UInt32
: Swapped color.
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | x | Color to process. |
Fade(Vector4, float)
Fade a color.
View Source
public static Vector4 Fade(this Vector4 color, float amount)
Returns
System.Numerics.Vector4
: The faded color.
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.Vector4 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
WithAlpha(Vector4, float)
Set alpha of a color.
View Source
public static Vector4 WithAlpha(this Vector4 color, float alpha)
Returns
System.Numerics.Vector4
: The color with the set alpha value.
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.Vector4 | color | The color. |
System.Single | alpha | The alpha value to set. |
Fade(uint, float)
Fade a color.
View Source
public static uint Fade(uint color, float amount)
Returns
System.UInt32
: The faded color.
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | color | The color to lighten. |
System.Single | amount | The amount to lighten. |
Vector(KnownColor)
Convert a KnownColor to a RGBA vector with values between 0.0f and 1.0f.
View Source
public static Vector4 Vector(this KnownColor knownColor)
Returns
System.Numerics.Vector4
: RGBA Vector with values between 0.0f and 1.0f.
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.KnownColor | knownColor | Known Color to convert. |
NormalizeToUnitRange(Vector4)
Normalizes a Vector4 with RGBA 255 color values to values between 0.0f and 1.0f If values are out of RGBA 255 range, the original value is returned.
View Source
public static Vector4 NormalizeToUnitRange(this Vector4 color)
Returns
System.Numerics.Vector4
: A vector with values between 0.0f and 1.0f.
Parameters
Type | Name | Description |
---|---|---|
System.Numerics.Vector4 | color | The color vector to convert. |