Gembox.Imaging
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    Color Struct

    Namespace:
    GemBox.Imaging
    Assembly:
    GemBox.Imaging.dll

    Represents a color.

    • C#
    • VB.NET
    public readonly struct Color : IEquatable<Color>
    Public Structure Color
        Implements IEquatable(Of Color)
    Implements
    System.IEquatable<Color>

    Constructors

    Color(Byte, Byte, Byte)

    Initializes a new instance of the Color struct with full opacity.

    • C#
    • VB.NET
    public Color(byte red, byte green, byte blue)
    Public Sub New(red As Byte, green As Byte, blue As Byte)
    Parameters
    red
    System.Byte

    The red component.

    green
    System.Byte

    The green component.

    blue
    System.Byte

    The blue component.

    Color(Byte, Byte, Byte, Byte)

    Initializes a new instance of the Color struct.

    • C#
    • VB.NET
    public Color(byte red, byte green, byte blue, byte alpha)
    Public Sub New(red As Byte, green As Byte, blue As Byte, alpha As Byte)
    Parameters
    red
    System.Byte

    The red component.

    green
    System.Byte

    The green component.

    blue
    System.Byte

    The blue component.

    alpha
    System.Byte

    The alpha component.

    Color(Single, Single, Single)

    Initializes a new instance of the Color struct with full opacity.

    • C#
    • VB.NET
    public Color(float red, float green, float blue)
    Public Sub New(red As Single, green As Single, blue As Single)
    Parameters
    red
    System.Single

    The normalized red component.

    green
    System.Single

    The normalized green component.

    blue
    System.Single

    The normalized blue component.

    Color(Single, Single, Single, Single)

    Initializes a new instance of the Color struct.

    • C#
    • VB.NET
    public Color(float red, float green, float blue, float alpha)
    Public Sub New(red As Single, green As Single, blue As Single, alpha As Single)
    Parameters
    red
    System.Single

    The normalized red component.

    green
    System.Single

    The normalized green component.

    blue
    System.Single

    The normalized blue component.

    alpha
    System.Single

    The normalized alpha component.

    Color(String)

    Initializes a new instance of the Color struct.

    • C#
    • VB.NET
    public Color(string hex)
    Public Sub New(hex As String)
    Parameters
    hex
    System.String

    The string that represents the color in the format #RRGGBBAA or #RRGGBB where RR is the byte that represents the red component, GG is the byte that represents the green component and BB is the byte that represents the blue component. AA is the byte that represents the alpha component.

    Fields

    Black

    Represents a black color (Hex = 0x000000).

    • C#
    • VB.NET
    public static readonly Color Black
    Public Shared ReadOnly Black As Color
    Field Value
    Color

    Blue

    Represents a blue color (Hex = 0x0000FF).

    • C#
    • VB.NET
    public static readonly Color Blue
    Public Shared ReadOnly Blue As Color
    Field Value
    Color

    Brown

    Represents a brown color (Hex = 0xA52A2A).

    • C#
    • VB.NET
    public static readonly Color Brown
    Public Shared ReadOnly Brown As Color
    Field Value
    Color

    Cyan

    Represents a cyan color (Hex = 0x00FFFF).

    • C#
    • VB.NET
    public static readonly Color Cyan
    Public Shared ReadOnly Cyan As Color
    Field Value
    Color

    DarkBlue

    Represents a dark blue color (Hex = 0x000080).

    • C#
    • VB.NET
    public static readonly Color DarkBlue
    Public Shared ReadOnly DarkBlue As Color
    Field Value
    Color

    DarkCyan

    Represents a dark cyan color (Hex = 0x008080).

    • C#
    • VB.NET
    public static readonly Color DarkCyan
    Public Shared ReadOnly DarkCyan As Color
    Field Value
    Color

    DarkGray

    Represents a dark gray color (Hex = 0x808080).

    • C#
    • VB.NET
    public static readonly Color DarkGray
    Public Shared ReadOnly DarkGray As Color
    Field Value
    Color

    DarkGreen

    Represents a dark green color (Hex = 0x008000).

    • C#
    • VB.NET
    public static readonly Color DarkGreen
    Public Shared ReadOnly DarkGreen As Color
    Field Value
    Color

    DarkMagenta

    Represents a dark magenta color (Hex = 0x800080).

    • C#
    • VB.NET
    public static readonly Color DarkMagenta
    Public Shared ReadOnly DarkMagenta As Color
    Field Value
    Color

    DarkRed

    Represents a dark red color (Hex = 0x800000).

    • C#
    • VB.NET
    public static readonly Color DarkRed
    Public Shared ReadOnly DarkRed As Color
    Field Value
    Color

    DarkYellow

    Represents a dark yellow color (Hex = 0x808000).

    • C#
    • VB.NET
    public static readonly Color DarkYellow
    Public Shared ReadOnly DarkYellow As Color
    Field Value
    Color

    Empty

    Represents an empty color (Hex = 0x00000000).

    • C#
    • VB.NET
    public static readonly Color Empty
    Public Shared ReadOnly Empty As Color
    Field Value
    Color

    Gray

    Represents a gray color (Hex = 0x808080).

    • C#
    • VB.NET
    public static readonly Color Gray
    Public Shared ReadOnly Gray As Color
    Field Value
    Color

    Green

    Represents a green color (Hex = 0x00FF00).

    • C#
    • VB.NET
    public static readonly Color Green
    Public Shared ReadOnly Green As Color
    Field Value
    Color

    LightGray

    Represents a light gray color (Hex = 0xC0C0C0).

    • C#
    • VB.NET
    public static readonly Color LightGray
    Public Shared ReadOnly LightGray As Color
    Field Value
    Color

    Magenta

    Represents a magenta color (Hex = 0xFF00FF).

    • C#
    • VB.NET
    public static readonly Color Magenta
    Public Shared ReadOnly Magenta As Color
    Field Value
    Color

    Orange

    Represents an orange color (Hex = 0xFFA500).

    • C#
    • VB.NET
    public static readonly Color Orange
    Public Shared ReadOnly Orange As Color
    Field Value
    Color

    Pink

    Represents a pink color (Hex = 0xFFC0CB).

    • C#
    • VB.NET
    public static readonly Color Pink
    Public Shared ReadOnly Pink As Color
    Field Value
    Color

    Purple

    Represents a purple color (Hex = 0x800080).

    • C#
    • VB.NET
    public static readonly Color Purple
    Public Shared ReadOnly Purple As Color
    Field Value
    Color

    Red

    Represents a red color (Hex = 0xFF0000).

    • C#
    • VB.NET
    public static readonly Color Red
    Public Shared ReadOnly Red As Color
    Field Value
    Color

    White

    Represents a write color (Hex = 0xFFFFFF).

    • C#
    • VB.NET
    public static readonly Color White
    Public Shared ReadOnly White As Color
    Field Value
    Color

    Yellow

    Represents a yellow color (Hex = 0xFFFF00).

    • C#
    • VB.NET
    public static readonly Color Yellow
    Public Shared ReadOnly Yellow As Color
    Field Value
    Color

    Properties

    B

    Gets the normalized blue component of this Color instance.

    • C#
    • VB.NET
    public readonly float B { get; }
    Public ReadOnly Property B As Single
    Property Value
    System.Single

    The normalized blue component of this Color instance.

    G

    Gets the normalized green component of this Color instance.

    • C#
    • VB.NET
    public readonly float G { get; }
    Public ReadOnly Property G As Single
    Property Value
    System.Single

    The normalized green component of this Color instance.

    IsEmpty

    Gets a value indicating whether this Color instance is empty.

    • C#
    • VB.NET
    public readonly bool IsEmpty { get; }
    Public ReadOnly Property IsEmpty As Boolean
    Property Value
    System.Boolean

    true if this Color instance is empty; otherwise, false.

    R

    Gets the normalized red component of this Color instance.

    • C#
    • VB.NET
    public readonly float R { get; }
    Public ReadOnly Property R As Single
    Property Value
    System.Single

    The normalized red component of this Color instance.

    Methods

    Equals(Color)

    Determines whether otherColor is equal to this Color instance.

    • C#
    • VB.NET
    public readonly bool Equals(Color other)
    Public Function Equals(other As Color) As Boolean
    Parameters
    other
    Color

    The other color to compare with this color instance.

    Returns
    System.Boolean

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

    Equals(Object)

    Determines whether the specified System.Object is equal to this Color instance.

    • C#
    • VB.NET
    public override readonly bool Equals(object obj)
    Public Overrides Function Equals(obj As Object) As Boolean
    Parameters
    obj
    System.Object

    The System.Object to compare with this color instance.

    Returns
    System.Boolean

    true if the specified System.Object is a Color and is equal to this Color instance; otherwise, false.

    Overrides
    System.ValueType.Equals(System.Object)

    GetHashCode()

    Returns a hash code for this Color instance.

    • C#
    • VB.NET
    public override readonly int GetHashCode()
    Public Overrides Function GetHashCode As Integer
    Returns
    System.Int32

    An integer value that specifies a hash value for this Color instance.

    Overrides
    System.ValueType.GetHashCode()

    ToString()

    Returns a System.String that represents this Color instance.

    • C#
    • VB.NET
    public override readonly string ToString()
    Public Overrides Function ToString As String
    Returns
    System.String

    A System.String that represents this Color instance.

    Overrides
    System.ValueType.ToString()

    Operators

    Equality(Color, Color)

    Determines whether two specified Colors have the same value.

    • C#
    • VB.NET
    public static bool operator ==(Color first, Color second)
    Public Shared Operator =(first As Color, second As Color) As Boolean
    Parameters
    first
    Color

    The first color to compare.

    second
    Color

    The second color to compare.

    Returns
    System.Boolean

    true if two specified Colors have the same value; otherwise, false.

    Inequality(Color, Color)

    Determines whether two specified Colors have different values.

    • C#
    • VB.NET
    public static bool operator !=(Color first, Color second)
    Public Shared Operator <>(first As Color, second As Color) As Boolean
    Parameters
    first
    Color

    The first color to compare.

    second
    Color

    The second color to compare.

    Returns
    System.Boolean

    true if two specified Colors have different values; otherwise, false.

    Implements

    System.IEquatable<T>
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.