Skip to main content
Color Structure
 

Represents an ARGB (alpha, red, green, blue) color.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

[SerializableAttribute]
[TypeConverterAttribute(typeof(ColorConverter))]
public struct Color
[SerializableAttribute]
[TypeConverterAttribute((ColorConverter^::typeid))]
public value struct Color
[<Sealed>]
[<SerializableAttribute>]
[<TypeConverterAttribute(typeof(ColorConverter))>]
type Color = struct end
<SerializableAttribute>
<TypeConverterAttribute(GetType(ColorConverter))>
Public Structure Color
NameDescription
System_CAPS_pubproperty

Gets the alpha component value of this Color structure.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF0F8FF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFAEBD7.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF00FFFF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF7FFFD4.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF0FFFF.

System_CAPS_pubproperty

Gets the blue component value of this Color structure.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF5F5DC.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFE4C4.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF000000.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFEBCD.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF0000FF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF8A2BE2.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFA52A2A.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFDEB887.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF5F9EA0.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF7FFF00.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFD2691E.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFF7F50.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF6495ED.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFF8DC.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFDC143C.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF00FFFF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF00008B.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF008B8B.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFB8860B.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFA9A9A9.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF006400.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFBDB76B.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF8B008B.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF556B2F.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFF8C00.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF9932CC.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF8B0000.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFE9967A.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF8FBC8F.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF483D8B.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF2F4F4F.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF00CED1.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF9400D3.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFF1493.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF00BFFF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF696969.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF1E90FF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFB22222.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFFAF0.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF228B22.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFF00FF.

System_CAPS_pubproperty

Gets the green component value of this Color structure.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFDCDCDC.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF8F8FF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFD700.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFDAA520.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF808080.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF008000.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFADFF2F.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF0FFF0.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFF69B4.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFCD5C5C.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF4B0082.

System_CAPS_pubproperty

Specifies whether this Color structure is uninitialized.

System_CAPS_pubproperty

Gets a value indicating whether this Color structure is a predefined color. Predefined colors are represented by the elements of the KnownColor enumeration.

System_CAPS_pubproperty

Gets a value indicating whether this Color structure is a named color or a member of the KnownColor enumeration.

System_CAPS_pubproperty

Gets a value indicating whether this Color structure is a system color. A system color is a color that is used in a Windows display element. System colors are represented by elements of the KnownColor enumeration.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFFFF0.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF0E68C.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFE6E6FA.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFF0F5.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF7CFC00.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFFACD.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFADD8E6.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF08080.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFE0FFFF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFAFAD2.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFD3D3D3.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF90EE90.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFB6C1.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFA07A.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF20B2AA.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF87CEFA.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF778899.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFB0C4DE.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFFFE0.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF00FF00.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF32CD32.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFAF0E6.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFF00FF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF800000.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF66CDAA.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF0000CD.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFBA55D3.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF9370DB.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF3CB371.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF7B68EE.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF00FA9A.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF48D1CC.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFC71585.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF191970.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF5FFFA.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFE4E1.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFE4B5.

System_CAPS_pubproperty

Gets the name of this Color.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFDEAD.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF000080.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFDF5E6.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF808000.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF6B8E23.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFA500.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFF4500.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFDA70D6.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFEEE8AA.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF98FB98.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFAFEEEE.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFDB7093.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFEFD5.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFDAB9.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFCD853F.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFC0CB.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFDDA0DD.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFB0E0E6.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF800080.

System_CAPS_pubproperty

Gets the red component value of this Color structure.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFF0000.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFBC8F8F.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF4169E1.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF8B4513.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFA8072.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF4A460.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF2E8B57.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFF5EE.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFA0522D.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFC0C0C0.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF87CEEB.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF6A5ACD.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF708090.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFFAFA.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF00FF7F.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF4682B4.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFD2B48C.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF008080.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFD8BFD8.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFF6347.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF40E0D0.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFEE82EE.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF5DEB3.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFFFFF.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFF5F5F5.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FFFFFF00.

System_CAPS_pubproperty System_CAPS_static

Gets a system-defined color that has an ARGB value of #FF9ACD32.

NameDescription
System_CAPS_pubmethod Equals

Tests whether the specified object is a Color structure and is equivalent to this Color structure.(Overrides ValueTypeEquals.)

System_CAPS_pubmethod System_CAPS_static FromArgb

Creates a Color structure from a 32-bit ARGB value.

System_CAPS_pubmethod System_CAPS_static FromArgb

Creates a Color structure from the specified Color structure, but with the new specified alpha value. Although this method allows a 32-bit value to be passed for the alpha value, the value is limited to 8 bits.

System_CAPS_pubmethod System_CAPS_static FromArgb

Creates a Color structure from the specified 8-bit color values (red, green, and blue). The alpha value is implicitly 255 (fully opaque). Although this method allows a 32-bit value to be passed for each color component, the value of each component is limited to 8 bits.

System_CAPS_pubmethod System_CAPS_static FromArgb

Creates a Color structure from the four ARGB component (alpha, red, green, and blue) values. Although this method allows a 32-bit value to be passed for each component, the value of each component is limited to 8 bits.

System_CAPS_pubmethod System_CAPS_static FromKnownColor

Creates a Color structure from the specified predefined color.

System_CAPS_pubmethod System_CAPS_static FromName

Creates a Color structure from the specified name of a predefined color.

System_CAPS_pubmethod GetBrightness

Gets the hue-saturation-brightness (HSB) brightness value for this Color structure.

System_CAPS_pubmethod GetHashCode

Returns a hash code for this Color structure.(Overrides ValueTypeGetHashCode.)

System_CAPS_pubmethod GetHue

Gets the hue-saturation-brightness (HSB) hue value, in degrees, for this Color structure.

System_CAPS_pubmethod GetSaturation

Gets the hue-saturation-brightness (HSB) saturation value for this Color structure.

System_CAPS_pubmethod GetType

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethod ToArgb

Gets the 32-bit ARGB value of this Color structure.

System_CAPS_pubmethod ToKnownColor

Gets the KnownColor value of this Color structure.

System_CAPS_pubmethod ToString

Converts this Color structure to a human-readable string.(Overrides ValueTypeToString.)

NameDescription
System_CAPS_pubfield System_CAPS_static Empty

Represents a color that is null.

NameDescription
System_CAPS_puboperator System_CAPS_static Equality

Tests whether two specified Color structures are equivalent.

System_CAPS_puboperator System_CAPS_static Inequality

Tests whether two specified Color structures are different.

Named colors are represented by using the properties of the Color structure. For more information about these colors, see Colors by Name.

The color of each pixel is represented as a 32-bit number: 8 bits each for alpha, red, green, and blue (ARGB). Each of the four components is a number from 0 through 255, with 0 representing no intensity and 255 representing full intensity. The alpha component specifies the transparency of the color: 0 is fully transparent, and 255 is fully opaque. To determine the alpha, red, green, or blue component of a color, use the , , , or property, respectively. You can create a custom color by using one of the FromArgb methods.

The following code example demonstrates the , , , and properties of a Color, and the member.

This example is designed to be used with a Windows Form. Paste the code into the form and call the ShowPropertiesOfSlateBlue method from the form's Paint event-handling method, passing e as PaintEventArgs.

private void ShowPropertiesOfSlateBlue(PaintEventArgs e)
{
    Color slateBlue = Color.FromName("SlateBlue");
    byte g = slateBlue.G;
    byte b = slateBlue.B;
    byte r = slateBlue.R;
    byte a = slateBlue.A;
    string text = String.Format("Slate Blue has these ARGB values: Alpha:{0}, " +
        "red:{1}, green: {2}, blue {3}", new object[]{a, r, g, b});
    e.Graphics.DrawString(text, 
        new Font(this.Font, FontStyle.Italic), 
        new SolidBrush(slateBlue), 
        new RectangleF(new PointF(0.0F, 0.0F), this.Size));
}
Private Sub ShowPropertiesOfSlateBlue(ByVal e As PaintEventArgs)
    Dim slateBlue As Color = Color.FromName("SlateBlue")
    Dim g As Byte = slateBlue.G
    Dim b As Byte = slateBlue.B
    Dim r As Byte = slateBlue.R
    Dim a As Byte = slateBlue.A
    Dim text As String = _
    String.Format("Slate Blue has these ARGB values: Alpha:{0}, " _
       & "red:{1}, green: {2}, blue {3}", New Object() {a, r, g, b})
    e.Graphics.DrawString(text, New Font(Me.Font, FontStyle.Italic), _
        New SolidBrush(slateBlue), _
        New RectangleF(New PointF(0.0F, 0.0F), _
        Size.op_Implicit(Me.Size)))
End Sub
void ShowPropertiesOfSlateBlue( PaintEventArgs^ e )
{
   Color slateBlue = Color::FromName( "SlateBlue" );
   Byte g = slateBlue.G;
   Byte b = slateBlue.B;
   Byte r = slateBlue.R;
   Byte a = slateBlue.A;
   array<Object^>^temp0 = {a,r,g,b};
   String^ text = String::Format( "Slate Blue has these ARGB values: Alpha:{0}, "
   "red:{1}, green: {2}, blue {3}", temp0 );
   e->Graphics->DrawString( text, gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), gcnew SolidBrush( slateBlue ), RectangleF(PointF(0.0F,0.0F),this->Size) );
}
.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top