Search Results for

    Show / Hide Table of Contents

    Class Color

    Representation of the RGBA color.

    Inheritance
    System.Object
    Color
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public sealed class Color : ValueType

    Constructors

    Color(Byte, Byte, Byte, Byte)

    Constructs a new Color with given r,g,b,a components (values in range [0;255]).

    Declaration
    public Color(byte r, byte g, byte b, byte a = 255)
    Parameters
    System.Byte r

    Red component.

    System.Byte g

    Green component.

    System.Byte b

    Blue component.

    System.Byte a

    Alpha component.

    Color(Int32, Int32, Int32, Int32)

    Constructs a new Color with given r,g,b,a components (values in range [0;255]).

    Declaration
    public Color(int r, int g, int b, int a = 255)
    Parameters
    System.Int32 r

    Red component.

    System.Int32 g

    Green component.

    System.Int32 b

    Blue component.

    System.Int32 a

    Alpha component.

    Color(Single)

    Constructs a new Color with given r,g,b,a component.

    Declaration
    public Color(float rgba)
    Parameters
    System.Single rgba

    RGBA component.

    Color(Single, Single, Single)

    Constructs a new Color with given r,g,b components and sets alpha to 1.

    Declaration
    public Color(float r, float g, float b)
    Parameters
    System.Single r

    Red component.

    System.Single g

    Green component.

    System.Single b

    Blue component.

    Color(Single, Single, Single, Single)

    Constructs a new Color with given r,g,b,a components (values in range [0;1]).

    Declaration
    public Color(float r, float g, float b, float a)
    Parameters
    System.Single r

    Red component.

    System.Single g

    Green component.

    System.Single b

    Blue component.

    System.Single a

    Alpha component.

    Color(Single[])

    Initializes a new instance of the Color struct.

    Declaration
    public Color(float[] values)
    Parameters
    System.Single[] values

    The values to assign to the red, green, blue, and alpha components of the color. This must be an array with four elements.

    Exceptions
    System.ArgumentNullException

    Thrown when values is null.

    System.ArgumentOutOfRangeException

    Thrown when values contains more or less than four elements.

    Fields

    A

    The alpha channel value.

    Declaration
    public float A
    Field Value
    System.Single

    AliceBlue

    AliceBlue color.

    Declaration
    public static readonly Color AliceBlue
    Field Value
    Color

    AntiqueWhite

    AntiqueWhite color.

    Declaration
    public static readonly Color AntiqueWhite
    Field Value
    Color

    Aqua

    Aqua color.

    Declaration
    public static readonly Color Aqua
    Field Value
    Color

    Aquamarine

    Aquamarine color.

    Declaration
    public static readonly Color Aquamarine
    Field Value
    Color

    Azure

    Azure color.

    Declaration
    public static readonly Color Azure
    Field Value
    Color

    B

    The blue channel value.

    Declaration
    public float B
    Field Value
    System.Single

    Beige

    Beige color.

    Declaration
    public static readonly Color Beige
    Field Value
    Color

    Bisque

    Bisque color.

    Declaration
    public static readonly Color Bisque
    Field Value
    Color

    Black

    Black color.

    Declaration
    public static readonly Color Black
    Field Value
    Color

    BlanchedAlmond

    BlanchedAlmond color.

    Declaration
    public static readonly Color BlanchedAlmond
    Field Value
    Color

    Blue

    Blue color.

    Declaration
    public static readonly Color Blue
    Field Value
    Color

    BlueViolet

    BlueViolet color.

    Declaration
    public static readonly Color BlueViolet
    Field Value
    Color

    Brown

    Brown color.

    Declaration
    public static readonly Color Brown
    Field Value
    Color

    BurlyWood

    BurlyWood color.

    Declaration
    public static readonly Color BurlyWood
    Field Value
    Color

    CadetBlue

    CadetBlue color.

    Declaration
    public static readonly Color CadetBlue
    Field Value
    Color

    Chartreuse

    Chartreuse color.

    Declaration
    public static readonly Color Chartreuse
    Field Value
    Color

    Chocolate

    Chocolate color.

    Declaration
    public static readonly Color Chocolate
    Field Value
    Color

    Coral

    Coral color.

    Declaration
    public static readonly Color Coral
    Field Value
    Color

    CornflowerBlue

    CornflowerBlue color.

    Declaration
    public static readonly Color CornflowerBlue
    Field Value
    Color

    Cornsilk

    Cornsilk color.

    Declaration
    public static readonly Color Cornsilk
    Field Value
    Color

    Crimson

    Crimson color.

    Declaration
    public static readonly Color Crimson
    Field Value
    Color

    Cyan

    Cyan color.

    Declaration
    public static readonly Color Cyan
    Field Value
    Color

    DarkBlue

    DarkBlue color.

    Declaration
    public static readonly Color DarkBlue
    Field Value
    Color

    DarkCyan

    DarkCyan color.

    Declaration
    public static readonly Color DarkCyan
    Field Value
    Color

    DarkGoldenrod

    DarkGoldenrod color.

    Declaration
    public static readonly Color DarkGoldenrod
    Field Value
    Color

    DarkGray

    DarkGray color.

    Declaration
    public static readonly Color DarkGray
    Field Value
    Color

    DarkGreen

    DarkGreen color.

    Declaration
    public static readonly Color DarkGreen
    Field Value
    Color

    DarkKhaki

    DarkKhaki color.

    Declaration
    public static readonly Color DarkKhaki
    Field Value
    Color

    DarkMagenta

    DarkMagenta color.

    Declaration
    public static readonly Color DarkMagenta
    Field Value
    Color

    DarkOliveGreen

    DarkOliveGreen color.

    Declaration
    public static readonly Color DarkOliveGreen
    Field Value
    Color

    DarkOrange

    DarkOrange color.

    Declaration
    public static readonly Color DarkOrange
    Field Value
    Color

    DarkOrchid

    DarkOrchid color.

    Declaration
    public static readonly Color DarkOrchid
    Field Value
    Color

    DarkRed

    DarkRed color.

    Declaration
    public static readonly Color DarkRed
    Field Value
    Color

    DarkSalmon

    DarkSalmon color.

    Declaration
    public static readonly Color DarkSalmon
    Field Value
    Color

    DarkSeaGreen

    DarkSeaGreen color.

    Declaration
    public static readonly Color DarkSeaGreen
    Field Value
    Color

    DarkSlateBlue

    DarkSlateBlue color.

    Declaration
    public static readonly Color DarkSlateBlue
    Field Value
    Color

    DarkSlateGray

    DarkSlateGray color.

    Declaration
    public static readonly Color DarkSlateGray
    Field Value
    Color

    DarkTurquoise

    DarkTurquoise color.

    Declaration
    public static readonly Color DarkTurquoise
    Field Value
    Color

    DarkViolet

    DarkViolet color.

    Declaration
    public static readonly Color DarkViolet
    Field Value
    Color

    DeepPink

    DeepPink color.

    Declaration
    public static readonly Color DeepPink
    Field Value
    Color

    DeepSkyBlue

    DeepSkyBlue color.

    Declaration
    public static readonly Color DeepSkyBlue
    Field Value
    Color

    DimGray

    DimGray color.

    Declaration
    public static readonly Color DimGray
    Field Value
    Color

    DodgerBlue

    DodgerBlue color.

    Declaration
    public static readonly Color DodgerBlue
    Field Value
    Color

    Firebrick

    Firebrick color.

    Declaration
    public static readonly Color Firebrick
    Field Value
    Color

    FloralWhite

    FloralWhite color.

    Declaration
    public static readonly Color FloralWhite
    Field Value
    Color

    ForestGreen

    ForestGreen color.

    Declaration
    public static readonly Color ForestGreen
    Field Value
    Color

    Fuchsia

    Fuchsia color.

    Declaration
    public static readonly Color Fuchsia
    Field Value
    Color

    G

    The green channel value.

    Declaration
    public float G
    Field Value
    System.Single

    Gainsboro

    Gainsboro color.

    Declaration
    public static readonly Color Gainsboro
    Field Value
    Color

    GhostWhite

    GhostWhite color.

    Declaration
    public static readonly Color GhostWhite
    Field Value
    Color

    Gold

    Gold color.

    Declaration
    public static readonly Color Gold
    Field Value
    Color

    Goldenrod

    Goldenrod color.

    Declaration
    public static readonly Color Goldenrod
    Field Value
    Color

    Gray

    Gray color.

    Declaration
    public static readonly Color Gray
    Field Value
    Color

    Green

    Green color.

    Declaration
    public static readonly Color Green
    Field Value
    Color

    GreenYellow

    GreenYellow color.

    Declaration
    public static readonly Color GreenYellow
    Field Value
    Color

    Honeydew

    Honeydew color.

    Declaration
    public static readonly Color Honeydew
    Field Value
    Color

    HotPink

    HotPink color.

    Declaration
    public static readonly Color HotPink
    Field Value
    Color

    IndianRed

    IndianRed color.

    Declaration
    public static readonly Color IndianRed
    Field Value
    Color

    Indigo

    Indigo color.

    Declaration
    public static readonly Color Indigo
    Field Value
    Color

    Ivory

    Ivory color.

    Declaration
    public static readonly Color Ivory
    Field Value
    Color

    Khaki

    Khaki color.

    Declaration
    public static readonly Color Khaki
    Field Value
    Color

    Lavender

    Lavender color.

    Declaration
    public static readonly Color Lavender
    Field Value
    Color

    LavenderBlush

    LavenderBlush color.

    Declaration
    public static readonly Color LavenderBlush
    Field Value
    Color

    LawnGreen

    LawnGreen color.

    Declaration
    public static readonly Color LawnGreen
    Field Value
    Color

    LemonChiffon

    LemonChiffon color.

    Declaration
    public static readonly Color LemonChiffon
    Field Value
    Color

    LightBlue

    LightBlue color.

    Declaration
    public static readonly Color LightBlue
    Field Value
    Color

    LightCoral

    LightCoral color.

    Declaration
    public static readonly Color LightCoral
    Field Value
    Color

    LightCyan

    LightCyan color.

    Declaration
    public static readonly Color LightCyan
    Field Value
    Color

    LightGoldenrodYellow

    LightGoldenrodYellow color.

    Declaration
    public static readonly Color LightGoldenrodYellow
    Field Value
    Color

    LightGray

    LightGray color.

    Declaration
    public static readonly Color LightGray
    Field Value
    Color

    LightGreen

    LightGreen color.

    Declaration
    public static readonly Color LightGreen
    Field Value
    Color

    LightPink

    LightPink color.

    Declaration
    public static readonly Color LightPink
    Field Value
    Color

    LightSalmon

    LightSalmon color.

    Declaration
    public static readonly Color LightSalmon
    Field Value
    Color

    LightSeaGreen

    LightSeaGreen color.

    Declaration
    public static readonly Color LightSeaGreen
    Field Value
    Color

    LightSkyBlue

    LightSkyBlue color.

    Declaration
    public static readonly Color LightSkyBlue
    Field Value
    Color

    LightSlateGray

    LightSlateGray color.

    Declaration
    public static readonly Color LightSlateGray
    Field Value
    Color

    LightSteelBlue

    LightSteelBlue color.

    Declaration
    public static readonly Color LightSteelBlue
    Field Value
    Color

    LightYellow

    LightYellow color.

    Declaration
    public static readonly Color LightYellow
    Field Value
    Color

    Lime

    Lime color.

    Declaration
    public static readonly Color Lime
    Field Value
    Color

    LimeGreen

    LimeGreen color.

    Declaration
    public static readonly Color LimeGreen
    Field Value
    Color

    Linen

    Linen color.

    Declaration
    public static readonly Color Linen
    Field Value
    Color

    Magenta

    Magenta color.

    Declaration
    public static readonly Color Magenta
    Field Value
    Color

    Maroon

    Maroon color.

    Declaration
    public static readonly Color Maroon
    Field Value
    Color

    MediumAquamarine

    MediumAquamarine color.

    Declaration
    public static readonly Color MediumAquamarine
    Field Value
    Color

    MediumBlue

    MediumBlue color.

    Declaration
    public static readonly Color MediumBlue
    Field Value
    Color

    MediumOrchid

    MediumOrchid color.

    Declaration
    public static readonly Color MediumOrchid
    Field Value
    Color

    MediumPurple

    MediumPurple color.

    Declaration
    public static readonly Color MediumPurple
    Field Value
    Color

    MediumSeaGreen

    MediumSeaGreen color.

    Declaration
    public static readonly Color MediumSeaGreen
    Field Value
    Color

    MediumSlateBlue

    MediumSlateBlue color.

    Declaration
    public static readonly Color MediumSlateBlue
    Field Value
    Color

    MediumSpringGreen

    MediumSpringGreen color.

    Declaration
    public static readonly Color MediumSpringGreen
    Field Value
    Color

    MediumTurquoise

    MediumTurquoise color.

    Declaration
    public static readonly Color MediumTurquoise
    Field Value
    Color

    MediumVioletRed

    MediumVioletRed color.

    Declaration
    public static readonly Color MediumVioletRed
    Field Value
    Color

    MidnightBlue

    MidnightBlue color.

    Declaration
    public static readonly Color MidnightBlue
    Field Value
    Color

    MintCream

    MintCream color.

    Declaration
    public static readonly Color MintCream
    Field Value
    Color

    MistyRose

    MistyRose color.

    Declaration
    public static readonly Color MistyRose
    Field Value
    Color

    Moccasin

    Moccasin color.

    Declaration
    public static readonly Color Moccasin
    Field Value
    Color

    NavajoWhite

    NavajoWhite color.

    Declaration
    public static readonly Color NavajoWhite
    Field Value
    Color

    Navy

    Navy color.

    Declaration
    public static readonly Color Navy
    Field Value
    Color

    OldLace

    OldLace color.

    Declaration
    public static readonly Color OldLace
    Field Value
    Color

    Olive

    Olive color.

    Declaration
    public static readonly Color Olive
    Field Value
    Color

    OliveDrab

    OliveDrab color.

    Declaration
    public static readonly Color OliveDrab
    Field Value
    Color

    Orange

    Orange color.

    Declaration
    public static readonly Color Orange
    Field Value
    Color

    OrangeRed

    OrangeRed color.

    Declaration
    public static readonly Color OrangeRed
    Field Value
    Color

    Orchid

    Orchid color.

    Declaration
    public static readonly Color Orchid
    Field Value
    Color

    PaleGoldenrod

    PaleGoldenrod color.

    Declaration
    public static readonly Color PaleGoldenrod
    Field Value
    Color

    PaleGreen

    PaleGreen color.

    Declaration
    public static readonly Color PaleGreen
    Field Value
    Color

    PaleTurquoise

    PaleTurquoise color.

    Declaration
    public static readonly Color PaleTurquoise
    Field Value
    Color

    PaleVioletRed

    PaleVioletRed color.

    Declaration
    public static readonly Color PaleVioletRed
    Field Value
    Color

    PapayaWhip

    PapayaWhip color.

    Declaration
    public static readonly Color PapayaWhip
    Field Value
    Color

    PeachPuff

    PeachPuff color.

    Declaration
    public static readonly Color PeachPuff
    Field Value
    Color

    Peru

    Peru color.

    Declaration
    public static readonly Color Peru
    Field Value
    Color

    Pink

    Pink color.

    Declaration
    public static readonly Color Pink
    Field Value
    Color

    Plum

    Plum color.

    Declaration
    public static readonly Color Plum
    Field Value
    Color

    PowderBlue

    PowderBlue color.

    Declaration
    public static readonly Color PowderBlue
    Field Value
    Color

    Purple

    Purple color.

    Declaration
    public static readonly Color Purple
    Field Value
    Color

    R

    The red channel value.

    Declaration
    public float R
    Field Value
    System.Single

    Red

    Red color.

    Declaration
    public static readonly Color Red
    Field Value
    Color

    RosyBrown

    RosyBrown color.

    Declaration
    public static readonly Color RosyBrown
    Field Value
    Color

    RoyalBlue

    RoyalBlue color.

    Declaration
    public static readonly Color RoyalBlue
    Field Value
    Color

    SaddleBrown

    SaddleBrown color.

    Declaration
    public static readonly Color SaddleBrown
    Field Value
    Color

    Salmon

    Salmon color.

    Declaration
    public static readonly Color Salmon
    Field Value
    Color

    SandyBrown

    SandyBrown color.

    Declaration
    public static readonly Color SandyBrown
    Field Value
    Color

    SeaGreen

    SeaGreen color.

    Declaration
    public static readonly Color SeaGreen
    Field Value
    Color

    SeaShell

    SeaShell color.

    Declaration
    public static readonly Color SeaShell
    Field Value
    Color

    Sienna

    Sienna color.

    Declaration
    public static readonly Color Sienna
    Field Value
    Color

    Silver

    Silver color.

    Declaration
    public static readonly Color Silver
    Field Value
    Color

    SizeInBytes

    The size of the Color type, in bytes.

    Declaration
    public static readonly int SizeInBytes
    Field Value
    System.Int32

    SkyBlue

    SkyBlue color.

    Declaration
    public static readonly Color SkyBlue
    Field Value
    Color

    SlateBlue

    SlateBlue color.

    Declaration
    public static readonly Color SlateBlue
    Field Value
    Color

    SlateGray

    SlateGray color.

    Declaration
    public static readonly Color SlateGray
    Field Value
    Color

    Snow

    Snow color.

    Declaration
    public static readonly Color Snow
    Field Value
    Color

    SpringGreen

    SpringGreen color.

    Declaration
    public static readonly Color SpringGreen
    Field Value
    Color

    SteelBlue

    SteelBlue color.

    Declaration
    public static readonly Color SteelBlue
    Field Value
    Color

    Tan

    Tan color.

    Declaration
    public static readonly Color Tan
    Field Value
    Color

    Teal

    Teal color.

    Declaration
    public static readonly Color Teal
    Field Value
    Color

    Thistle

    Thistle color.

    Declaration
    public static readonly Color Thistle
    Field Value
    Color

    Tomato

    Tomato color.

    Declaration
    public static readonly Color Tomato
    Field Value
    Color

    Transparent

    Transparent color.

    Declaration
    public static readonly Color Transparent
    Field Value
    Color

    Turquoise

    Turquoise color.

    Declaration
    public static readonly Color Turquoise
    Field Value
    Color

    Violet

    Violet color.

    Declaration
    public static readonly Color Violet
    Field Value
    Color

    Wheat

    Wheat color.

    Declaration
    public static readonly Color Wheat
    Field Value
    Color

    White

    White color.

    Declaration
    public static readonly Color White
    Field Value
    Color

    WhiteSmoke

    WhiteSmoke color.

    Declaration
    public static readonly Color WhiteSmoke
    Field Value
    Color

    Yellow

    Yellow color.

    Declaration
    public static readonly Color Yellow
    Field Value
    Color

    YellowGreen

    YellowGreen color.

    Declaration
    public static readonly Color YellowGreen
    Field Value
    Color

    Zero

    Zero color.

    Declaration
    public static readonly Color Zero
    Field Value
    Color

    Properties

    Default

    The default Color.

    Declaration
    public static Color Default { get; }
    Property Value
    Color

    Item[Int32]

    Gets or sets the component at the specified index.

    Declaration
    public float this[int index] { get; set; }
    Parameters
    System.Int32 index

    The index of the component to access. Use 0 for the alpha component, 1 for the red component, 2 for the green component, and 3 for the blue component.

    Property Value
    System.Single

    The value of the red, green, blue, and alpha components, depending on the index.

    Exceptions
    System.IndexOutOfRangeException

    Thrown when the index is out of the range [0, 3].

    MaxColorComponent

    Returns the maximum color component value: Max(r,g,b).

    Declaration
    public float MaxColorComponent { get; }
    Property Value
    System.Single

    MaxValue

    Gets a maximum component value (min of r,g,b,a).

    Declaration
    public float MaxValue { get; }
    Property Value
    System.Single

    MinColorComponent

    Returns the minimum color component value: Min(r,g,b).

    Declaration
    public float MinColorComponent { get; }
    Property Value
    System.Single

    MinValue

    Gets a minimum component value (max of r,g,b,a).

    Declaration
    public float MinValue { get; }
    Property Value
    System.Single

    ValuesSum

    Gets a sum of the component values.

    Declaration
    public float ValuesSum { get; }
    Property Value
    System.Single

    Methods

    AdjustContrast(Color, Single)

    Adjusts the contrast of a color.

    Declaration
    public static Color AdjustContrast(Color value, float contrast)
    Parameters
    Color value

    The color whose contrast is to be adjusted.

    System.Single contrast

    The amount by which to adjust the contrast.

    Returns
    Color

    The adjusted color.

    AdjustContrast(ref Color, Single, out Color)

    1 Adjusts the contrast of a color.

    Declaration
    public static void AdjustContrast(ref Color value, float contrast, out Color result)
    Parameters
    Color value

    The color whose contrast is to be adjusted.

    System.Single contrast

    The amount by which to adjust the contrast.

    Color result

    When the method completes, contains the adjusted color.

    AdjustSaturation(Color, Single)

    Adjusts the saturation of a color.

    Declaration
    public static Color AdjustSaturation(Color value, float saturation)
    Parameters
    Color value

    The color whose saturation is to be adjusted.

    System.Single saturation

    The amount by which to adjust the saturation.

    Returns
    Color

    The adjusted color.

    AdjustSaturation(ref Color, Single, out Color)

    Adjusts the saturation of a color.

    Declaration
    public static void AdjustSaturation(ref Color value, float saturation, out Color result)
    Parameters
    Color value

    The color whose saturation is to be adjusted.

    System.Single saturation

    The amount by which to adjust the saturation.

    Color result

    When the method completes, contains the adjusted color.

    AlphaMultiplied(Single)

    Returns the color with alpha channel multiplied by the given color. The RGB channels remain the same.

    Declaration
    public Color AlphaMultiplied(float multiplier)
    Parameters
    System.Single multiplier

    The multiplier.

    Returns
    Color

    The modified color.

    Clamp(Color, Color, Color)

    Restricts a value to be within a specified range.

    Declaration
    public static Color Clamp(Color value, Color min, Color max)
    Parameters
    Color value

    The value to clamp.

    Color min

    The minimum value.

    Color max

    The maximum value.

    Returns
    Color

    The clamped value.

    Clamp(ref Color, ref Color, ref Color, out Color)

    Restricts a value to be within a specified range.

    Declaration
    public static void Clamp(ref Color value, ref Color min, ref Color max, out Color result)
    Parameters
    Color value

    The value to clamp.

    Color min

    The minimum value.

    Color max

    The maximum value.

    Color result

    When the method completes, contains the clamped value.

    Equals(ref Color)

    Determines whether the specified Color is equal to this instance.

    Declaration
    public bool Equals(ref Color other)
    Parameters
    Color other

    The Color to compare with this instance.

    Returns
    System.Boolean

    true if the specified Color is equal to this instance; otherwise, false.

    Equals(Object)

    Declaration
    public override bool Equals(object other)
    Parameters
    System.Object other

    Returns
    System.Boolean

    FromARGB(UInt32)

    Creates Color from the ARGB value (bottom bits contain Blue).

    Declaration
    public static Color FromARGB(uint argb)
    Parameters
    System.UInt32 argb

    The packed ARGB value (bottom bits contain Blue).

    Returns
    Color

    The color.

    FromBgra(Int32)

    Converts the color from a packed BGRA integer.

    Declaration
    public static Color FromBgra(int color)
    Parameters
    System.Int32 color

    A packed integer containing all four color components in BGRA order

    Returns
    Color

    A color.

    FromBgra(UInt32)

    Converts the color from a packed BGRA integer.

    Declaration
    public static Color FromBgra(uint color)
    Parameters
    System.UInt32 color

    A packed integer containing all four color components in BGRA order

    Returns
    Color

    A color.

    FromHex(String)

    Creates Color from the Hex string.

    Declaration
    public static Color FromHex(string hex)
    Parameters
    System.String hex

    The hexadecimal color string.

    Returns
    Color

    The output color value.

    FromHex(String, out Color)

    Creates Color from the Hex string.

    Declaration
    public static bool FromHex(string hex, out Color color)
    Parameters
    System.String hex

    The hexadecimal color string.

    Color color

    The output color value. Valid if method returns true.

    Returns
    System.Boolean

    True if method was able to convert color, otherwise false.

    FromHSV(Float3, Single)

    Creates RGB color from Hue[0-360], Saturation[0-1] and Value[0-1] packed to XYZ vector.

    Declaration
    public static Color FromHSV(Float3 hsv, float alpha = 1F)
    Parameters
    Float3 hsv

    The HSV color.

    System.Single alpha

    The alpha value. Default is 1.

    Returns
    Color

    The RGB color.

    FromHSV(Single, Single, Single, Single)

    Creates RGB color from Hue[0-360], Saturation[0-1] and Value[0-1].

    Declaration
    public static Color FromHSV(float hue, float saturation, float value, float alpha = 1F)
    Parameters
    System.Single hue

    The hue angle in degrees [0-360].

    System.Single saturation

    The saturation normalized [0-1].

    System.Single value

    The value normalized [0-1].

    System.Single alpha

    The alpha value. Default is 1.

    Returns
    Color

    The RGB color.

    FromRGB(UInt32, Single)

    Creates Color from the RGB value (bottom bits contain Blue) and separate alpha channel.

    Declaration
    public static Color FromRGB(uint rgb, float a = 1F)
    Parameters
    System.UInt32 rgb

    The packed RGB value (bottom bits contain Blue).

    System.Single a

    The alpha channel value.

    Returns
    Color

    The color.

    FromRGBA(UInt32)

    Creates Color from the RGBA value (bottom bits contain Alpha).

    Declaration
    public static Color FromRGBA(uint rgba)
    Parameters
    System.UInt32 rgba

    The packed RGBA value (bottom bits Alpha Red).

    Returns
    Color

    The color.

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    System.Int32

    Lerp(Color, Color, Single)

    Linearly interpolates between colors a and b by t.

    Declaration
    public static Color Lerp(Color a, Color b, float t)
    Parameters
    Color a

    Color a

    Color b

    Color b

    System.Single t

    Float for combining a and b

    Returns
    Color

    Lerp(ref Color, ref Color, Single, out Color)

    Linearly interpolates between colors a and b by t.

    Declaration
    public static void Lerp(ref Color a, ref Color b, float t, out Color result)
    Parameters
    Color a

    Color a

    Color b

    Color b

    System.Single t

    Float for combining a and b

    Color result

    The result.

    Max(Color, Color)

    Returns a color containing the largest components of the specified colors.

    Declaration
    public static Color Max(Color left, Color right)
    Parameters
    Color left

    The first source color.

    Color right

    The second source color.

    Returns
    Color

    A color containing the largest components of the source colors.

    Max(ref Color, ref Color, out Color)

    Returns a color containing the largest components of the specified colors.

    Declaration
    public static void Max(ref Color left, ref Color right, out Color result)
    Parameters
    Color left

    The first source color.

    Color right

    The second source color.

    Color result

    When the method completes, contains an new color composed of the largest components of the source colors.

    Min(Color, Color)

    Returns a color containing the smallest components of the specified colors.

    Declaration
    public static Color Min(Color left, Color right)
    Parameters
    Color left

    The first source color.

    Color right

    The second source color.

    Returns
    Color

    A color containing the smallest components of the source colors.

    Min(ref Color, ref Color, out Color)

    Returns a color containing the smallest components of the specified colors.

    Declaration
    public static void Min(ref Color left, ref Color right, out Color result)
    Parameters
    Color left

    The first source color.

    Color right

    The second source color.

    Color result

    When the method completes, contains an new color composed of the smallest components of the source colors.

    Parse(String)

    Creates Color from the text string (hex or color name).

    Declaration
    public static Color Parse(string text)
    Parameters
    System.String text

    The color string (hex or color name).

    Returns
    Color

    The color.

    ParseHex(String)

    Creates Color from the hexadecimal string.

    Declaration
    public static Color ParseHex(string hexString)
    Parameters
    System.String hexString

    The hexadecimal string.

    Returns
    Color

    The color.

    PremultiplyAlpha(Color)

    Premultiplies the color components by the alpha value.

    Declaration
    public static Color PremultiplyAlpha(Color value)
    Parameters
    Color value

    The color to premultiply.

    Returns
    Color

    A color with premultiplied alpha.

    RGBMultiplied(Color)

    Returns the color with RGB channels multiplied by the given color. The alpha channel remains the same.

    Declaration
    public Color RGBMultiplied(Color multiplier)
    Parameters
    Color multiplier

    The multiplier.

    Returns
    Color

    The modified color.

    RGBMultiplied(Single)

    Returns the color with RGB channels multiplied by the given scale factor. The alpha channel remains the same.

    Declaration
    public Color RGBMultiplied(float multiplier)
    Parameters
    System.Single multiplier

    The multiplier.

    Returns
    Color

    The modified color.

    RGBToHSV(Color, out Single, out Single, out Single)

    Convert color from the RGB color space to HSV color space.

    Declaration
    public static void RGBToHSV(Color rgbColor, out float h, out float s, out float v)
    Parameters
    Color rgbColor

    Color of the RGB.

    System.Single h

    The output Hue.

    System.Single s

    The output Saturation.

    System.Single v

    The output Value.

    ToArray()

    Creates an array containing the elements of the color.

    Declaration
    public float[] ToArray()
    Returns
    System.Single[]

    A four-element array containing the components of the color.

    ToBgra()

    Converts the color into a packed integer.

    Declaration
    public int ToBgra()
    Returns
    System.Int32

    A packed integer containing all four color components.

    ToBgra(out Byte, out Byte, out Byte, out Byte)

    Converts the color into a packed integer.

    Declaration
    public void ToBgra(out byte r, out byte g, out byte b, out byte a)
    Parameters
    System.Byte r

    System.Byte g

    System.Byte b

    System.Byte a

    ToHexString()

    Gets the color value as the hexadecimal string (in RGBA order).

    Declaration
    public string ToHexString()
    Returns
    System.String

    Hex string.

    ToHSV()

    Gets Hue[0-360], Saturation[0-1] and Value[0-1] from RGB color.

    Declaration
    public Float3 ToHSV()
    Returns
    Float3

    The HSV color.

    ToLinear()

    Converts this color from sRGB space to linear space.

    Declaration
    public Color ToLinear()
    Returns
    Color

    A Color in linear space.

    ToRgba()

    Converts the color into a packed integer.

    Declaration
    public int ToRgba()
    Returns
    System.Int32

    A packed integer containing all four color components.

    ToSRgb()

    Converts this color from linear space to sRGB space.

    Declaration
    public Color ToSRgb()
    Returns
    Color

    A color3 in sRGB space.

    ToString()

    Returns a nicely formatted string of this color.

    Declaration
    public override string ToString()
    Returns
    System.String

    ToString(String)

    Returns a nicely formatted string of this color.

    Declaration
    public string ToString(string format)
    Parameters
    System.String format

    Returns
    System.String

    TryParse(String, out Color)

    Creates Color from the string (hex or color name).

    Declaration
    public static bool TryParse(string text, out Color value)
    Parameters
    System.String text

    The color string (hex or color name).

    Color value

    Output value.

    Returns
    System.Boolean

    True if value has been parsed, otherwise false.

    TryParseHex(String, out Color)

    Creates Color from the hexadecimal string.

    Declaration
    public static bool TryParseHex(string hexString, out Color value)
    Parameters
    System.String hexString

    The hexadecimal string.

    Color value

    Output value.

    Returns
    System.Boolean

    True if value has been parsed, otherwise false.

    Operators

    Addition(Color, Color)

    Adds two colors.

    Declaration
    public static Color operator +(Color a, Color b)
    Parameters
    Color a

    The first color.

    Color b

    The second color.

    Returns
    Color

    The result of the operator.

    Division(Color, Single)

    Divides color by the scale factor.

    Declaration
    public static Color operator /(Color a, float b)
    Parameters
    Color a

    The first color.

    System.Single b

    The division factor.

    Returns
    Color

    The result of the operator.

    Equality(Color, Color)

    Compares two colors.

    Declaration
    public static bool operator ==(Color lhs, Color rhs)
    Parameters
    Color lhs

    The left.

    Color rhs

    The right.

    Returns
    System.Boolean

    True if colors are equal, otherwise false.

    Implicit(Color to Float3)

    Performs an implicit conversion from Color to Float3.

    Declaration
    public static implicit operator Float3(Color c)
    Parameters
    Color c

    The color.

    Returns
    Float3

    The result of the conversion.

    Implicit(Color to Float4)

    Performs an implicit conversion from Color to Float4.

    Declaration
    public static implicit operator Float4(Color c)
    Parameters
    Color c

    The color.

    Returns
    Float4

    The result of the conversion.

    Implicit(Color to Vector3)

    Performs an implicit conversion from Color to Vector3.

    Declaration
    public static implicit operator Vector3(Color c)
    Parameters
    Color c

    The color.

    Returns
    Vector3

    The result of the conversion.

    Implicit(Color to Vector4)

    Performs an implicit conversion from Color to Vector4.

    Declaration
    public static implicit operator Vector4(Color c)
    Parameters
    Color c

    The color.

    Returns
    Vector4

    The result of the conversion.

    Implicit(Float3 to Color)

    Performs an implicit conversion from Float3 to Color.

    Declaration
    public static implicit operator Color(Float3 v)
    Parameters
    Float3 v

    The vector.

    Returns
    Color

    The result of the conversion.

    Implicit(Float4 to Color)

    Performs an implicit conversion from Float4 to Color.

    Declaration
    public static implicit operator Color(Float4 v)
    Parameters
    Float4 v

    The vector.

    Returns
    Color

    The result of the conversion.

    Implicit(Vector3 to Color)

    Performs an implicit conversion from Vector3 to Color.

    Declaration
    public static implicit operator Color(Vector3 v)
    Parameters
    Vector3 v

    The vector.

    Returns
    Color

    The result of the conversion.

    Implicit(Vector4 to Color)

    Performs an implicit conversion from Vector4 to Color.

    Declaration
    public static implicit operator Color(Vector4 v)
    Parameters
    Vector4 v

    The vector.

    Returns
    Color

    The result of the conversion.

    Inequality(Color, Color)

    Compares two colors.

    Declaration
    public static bool operator !=(Color lhs, Color rhs)
    Parameters
    Color lhs

    The left.

    Color rhs

    The right.

    Returns
    System.Boolean

    True if colors are not equal, otherwise false.

    Multiply(Color, Color)

    Multiplies color components by the other color components.

    Declaration
    public static Color operator *(Color a, Color b)
    Parameters
    Color a

    The first color.

    Color b

    The second color.

    Returns
    Color

    The result of the operator.

    Multiply(Color, Single)

    Multiplies color components by the scale factor.

    Declaration
    public static Color operator *(Color a, float b)
    Parameters
    Color a

    The color.

    System.Single b

    The scale.

    Returns
    Color

    The result of the operator.

    Multiply(Single, Color)

    Multiplies color components by the scale factor.

    Declaration
    public static Color operator *(float b, Color a)
    Parameters
    System.Single b

    The scale.

    Color a

    The color.

    Returns
    Color

    The result of the operator.

    Subtraction(Color, Color)

    Subtracts one color from the another.

    Declaration
    public static Color operator -(Color a, Color b)
    Parameters
    Color a

    The first color.

    Color b

    The second color.

    Returns
    Color

    The result of the operator.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat