Skip to main content
.NET Framework Class Library
Colors Class

Implements a set of predefined colors.

Inheritance Hierarchy
SystemObject
  System.Windows.MediaColors

Namespace:   System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Syntax
Public NotInheritable Class Colors
public sealed class Colors
public ref class Colors sealed
[<[%$TOPIC/ms653064_en-us_VS_110_2_0_3_0_0%]>]
type Colors =  class end

You cannot declare this managed class in XAML, but you can use its static properties to assign values in XAML.

The Colors type exposes the following members.

Properties
  NameDescription
Public property Static member AliceBlueGets the system-defined color that has an ARGB value of #FFF0F8FF.
Public property Static member AntiqueWhiteGets the system-defined color that has an ARGB value of #FFFAEBD7.
Public property Static member AquaGets the system-defined color that has an ARGB value of #FF00FFFF.
Public property Static member AquamarineGets the system-defined color that has an ARGB value of #FF7FFFD4.
Public property Static member AzureGets the system-defined color that has an ARGB value of #FFF0FFFF.
Public property Static member BeigeGets the system-defined color that has an ARGB value of #FFF5F5DC.
Public property Static member BisqueGets the system-defined color that has an ARGB value of #FFFFE4C4.
Public property Static member BlackGets the system-defined color that has an ARGB value of #FF000000.
Public property Static member BlanchedAlmondGets the system-defined color that has an ARGB value of #FFFFEBCD.
Public property Static member BlueGets the system-defined color that has an ARGB value of #FF0000FF.
Public property Static member BlueVioletGets the system-defined color that has an ARGB value of #FF8A2BE2.
Public property Static member BrownGets the system-defined color that has an ARGB value of #FFA52A2A.
Public property Static member BurlyWoodGets the system-defined color that has an ARGB value of #FFDEB887.
Public property Static member CadetBlueGets the system-defined color that has an ARGB value of #FF5F9EA0.
Public property Static member ChartreuseGets the system-defined color that has an ARGB value of #FF7FFF00.
Public property Static member ChocolateGets the system-defined color that has an ARGB value of #FFD2691E.
Public property Static member CoralGets the system-defined color that has an ARGB value of #FFFF7F50.
Public property Static member CornflowerBlueGets the system-defined color that has an ARGB value of #FF6495ED.
Public property Static member CornsilkGets the system-defined color that has an ARGB value of #FFFFF8DC.
Public property Static member CrimsonGets the system-defined color that has an ARGB value of #FFDC143C.
Public property Static member CyanGets the system-defined color that has an ARGB value of #FF00FFFF.
Public property Static member DarkBlueGets the system-defined color that has an ARGB value of #FF00008B.
Public property Static member DarkCyanGets the system-defined color that has an ARGB value of #FF008B8B.
Public property Static member DarkGoldenrodGets the system-defined color that has an ARGB value of #FFB8860B.
Public property Static member DarkGrayGets the system-defined color that has an ARGB value of #FFA9A9A9.
Public property Static member DarkGreenGets the system-defined color that has an ARGB value of #FF006400.
Public property Static member DarkKhakiGets the system-defined color that has an ARGB value of #FFBDB76B.
Public property Static member DarkMagentaGets the system-defined color that has an ARGB value of #FF8B008B.
Public property Static member DarkOliveGreenGets the system-defined color that has an ARGB value of #FF556B2F.
Public property Static member DarkOrangeGets the system-defined color that has an ARGB value of #FFFF8C00.
Public property Static member DarkOrchidGets the system-defined color that has an ARGB value of #FF9932CC.
Public property Static member DarkRedGets the system-defined color that has an ARGB value of #FF8B0000.
Public property Static member DarkSalmonGets the system-defined color that has an ARGB value of #FFE9967A.
Public property Static member DarkSeaGreenGets the system-defined color that has an ARGB value of #FF8FBC8F.
Public property Static member DarkSlateBlueGets the system-defined color that has an ARGB value of #FF483D8B.
Public property Static member DarkSlateGrayGets the system-defined color that has an ARGB value of #FF2F4F4F.
Public property Static member DarkTurquoiseGets the system-defined color that has an ARGB value of #FF00CED1.
Public property Static member DarkVioletGets the system-defined color that has an ARGB value of #FF9400D3.
Public property Static member DeepPinkGets the system-defined color that has an ARGB value of #FFFF1493.
Public property Static member DeepSkyBlueGets the system-defined color that has an ARGB value of #FF00BFFF.
Public property Static member DimGrayGets the system-defined color that has an ARGB value of #FF696969.
Public property Static member DodgerBlueGets the system-defined color that has an ARGB value of #FF1E90FF.
Public property Static member FirebrickGets the system-defined color that has an ARGB value of #FFB22222.
Public property Static member FloralWhiteGets the system-defined color that has an ARGB value of #FFFFFAF0.
Public property Static member ForestGreenGets the system-defined color that has an ARGB value of #FF228B22.
Public property Static member FuchsiaGets the system-defined color that has an ARGB value of #FFFF00FF.
Public property Static member GainsboroGets the system-defined color that has an ARGB value of #FFDCDCDC.
Public property Static member GhostWhiteGets the system-defined color that has an ARGB value of #FFF8F8FF.
Public property Static member GoldGets the system-defined color that has an ARGB value of #FFFFD700.
Public property Static member GoldenrodGets the system-defined color that has an ARGB value of #FFDAA520.
Public property Static member GrayGets the system-defined color that has an ARGB value of #FF808080.
Public property Static member GreenGets the system-defined color that has an ARGB value of #FF008000.
Public property Static member GreenYellowGets the system-defined color that has an ARGB value of #FFADFF2F.
Public property Static member HoneydewGets the system-defined color that has an ARGB value of #FFF0FFF0.
Public property Static member HotPinkGets the system-defined color that has an ARGB value of #FFFF69B4.
Public property Static member IndianRedGets the system-defined color that has an ARGB value of #FFCD5C5C.
Public property Static member IndigoGets the system-defined color that has an ARGB value of #FF4B0082.
Public property Static member IvoryGets the system-defined color that has an ARGB value of #FFFFFFF0.
Public property Static member KhakiGets the system-defined color that has an ARGB value of #FFF0E68C.
Public property Static member LavenderGets the system-defined color that has an ARGB value of #FFE6E6FA.
Public property Static member LavenderBlushGets the system-defined color that has an ARGB value of #FFFFF0F5.
Public property Static member LawnGreenGets the system-defined color that has an ARGB value of #FF7CFC00.
Public property Static member LemonChiffonGets the system-defined color that has an ARGB value of #FFFFFACD.
Public property Static member LightBlueGets the system-defined color that has an ARGB value of #FFADD8E6.
Public property Static member LightCoralGets the system-defined color that has an ARGB value of #FFF08080.
Public property Static member LightCyanGets the system-defined color that has an ARGB value of #FFE0FFFF.
Public property Static member LightGoldenrodYellowGets the system-defined color that has an ARGB value of #FFFAFAD2.
Public property Static member LightGrayGets the system-defined color that has an ARGB value of #FFD3D3D3.
Public property Static member LightGreenGets the system-defined color that has an ARGB value of #FF90EE90.
Public property Static member LightPinkGets the system-defined color that has an ARGB value of #FFFFB6C1.
Public property Static member LightSalmonGets the system-defined color that has an ARGB value of #FFFFA07A.
Public property Static member LightSeaGreenGets the system-defined color that has an ARGB value of #FF20B2AA.
Public property Static member LightSkyBlueGets the system-defined color that has an ARGB value of #FF87CEFA.
Public property Static member LightSlateGrayGets the system-defined color that has an ARGB value of #FF778899.
Public property Static member LightSteelBlueGets the system-defined color that has an ARGB value of #FFB0C4DE.
Public property Static member LightYellowGets the system-defined color that has an ARGB value of #FFFFFFE0.
Public property Static member LimeGets the system-defined color that has an ARGB value of #FF00FF00.
Public property Static member LimeGreenGets the system-defined color that has an ARGB value of #FF32CD32.
Public property Static member LinenGets the system-defined color that has an ARGB value of #FFFAF0E6.
Public property Static member MagentaGets the system-defined color that has an ARGB value of #FFFF00FF.
Public property Static member MaroonGets the system-defined color that has an ARGB value of #FF800000.
Public property Static member MediumAquamarineGets the system-defined color that has an ARGB value of #FF66CDAA.
Public property Static member MediumBlueGets the system-defined color that has an ARGB value of #FF0000CD.
Public property Static member MediumOrchidGets the system-defined color that has an ARGB value of #FFBA55D3.
Public property Static member MediumPurpleGets the system-defined color that has an ARGB value of #FF9370DB.
Public property Static member MediumSeaGreenGets the system-defined color that has an ARGB value of #FF3CB371.
Public property Static member MediumSlateBlueGets the system-defined color that has an ARGB value of #FF7B68EE.
Public property Static member MediumSpringGreenGets the system-defined color that has an ARGB value of #FF00FA9A.
Public property Static member MediumTurquoiseGets the system-defined color that has an ARGB value of #FF48D1CC.
Public property Static member MediumVioletRedGets the system-defined color that has an ARGB value of #FFC71585.
Public property Static member MidnightBlueGets the system-defined color that has an ARGB value of #FF191970.
Public property Static member MintCreamGets the system-defined color that has an ARGB value of #FFF5FFFA.
Public property Static member MistyRoseGets the system-defined color that has an ARGB value of #FFFFE4E1.
Public property Static member MoccasinGets the system-defined color that has an ARGB value of #FFFFE4B5.
Public property Static member NavajoWhiteGets the system-defined color that has an ARGB value of #FFFFDEAD.
Public property Static member NavyGets the system-defined color that has an ARGB value of #FF000080.
Public property Static member OldLaceGets the system-defined color that has an ARGB value of #FFFDF5E6.
Public property Static member OliveGets the system-defined color that has an ARGB value of #FF808000.
Public property Static member OliveDrabGets the system-defined color that has an ARGB value of #FF6B8E23.
Public property Static member OrangeGets the system-defined color that has an ARGB value of #FFFFA500.
Public property Static member OrangeRedGets the system-defined color that has an ARGB value of #FFFF4500.
Public property Static member OrchidGets the system-defined color that has an ARGB value of #FFDA70D6.
Public property Static member PaleGoldenrodGets the system-defined color that has an ARGB value of #FFEEE8AA.
Public property Static member PaleGreenGets the system-defined color that has an ARGB value of #FF98FB98.
Public property Static member PaleTurquoiseGets the system-defined color that has an ARGB value of #FFAFEEEE.
Public property Static member PaleVioletRedGets the system-defined color that has an ARGB value of #FFDB7093.
Public property Static member PapayaWhipGets the system-defined color that has an ARGB value of #FFFFEFD5.
Public property Static member PeachPuffGets the system-defined color that has an ARGB value of #FFFFDAB9.
Public property Static member PeruGets the system-defined color that has an ARGB value of #FFCD853F.
Public property Static member PinkGets the system-defined color that has an ARGB value of #FFFFC0CB.
Public property Static member PlumGets the system-defined color that has an ARGB value of #FFDDA0DD.
Public property Static member PowderBlueGets the system-defined color that has an ARGB value of #FFB0E0E6.
Public property Static member PurpleGets the system-defined color that has an ARGB value of #FF800080.
Public property Static member RedGets the system-defined color that has an ARGB value of #FFFF0000.
Public property Static member RosyBrownGets the system-defined color that has an ARGB value of #FFBC8F8F.
Public property Static member RoyalBlueGets the system-defined color that has an ARGB value of #FF4169E1.
Public property Static member SaddleBrownGets the system-defined color that has an ARGB value of #FF8B4513.
Public property Static member SalmonGets the system-defined color that has an ARGB value of #FFFA8072.
Public property Static member SandyBrownGets the system-defined color that has an ARGB value of #FFF4A460.
Public property Static member SeaGreenGets the system-defined color that has an ARGB value of #FF2E8B57.
Public property Static member SeaShellGets the system-defined color that has an ARGB value of #FFFFF5EE.
Public property Static member SiennaGets the system-defined color that has an ARGB value of #FFA0522D.
Public property Static member SilverGets the system-defined color that has an ARGB value of #FFC0C0C0.
Public property Static member SkyBlueGets the system-defined color that has an ARGB value of #FF87CEEB.
Public property Static member SlateBlueGets the system-defined color that has an ARGB value of #FF6A5ACD.
Public property Static member SlateGrayGets the system-defined color that has an ARGB value of #FF708090.
Public property Static member SnowGets the system-defined color that has an ARGB value of #FFFFFAFA.
Public property Static member SpringGreenGets the system-defined color that has an ARGB value of #FF00FF7F.
Public property Static member SteelBlueGets the system-defined color that has an ARGB value of #FF4682B4.
Public property Static member TanGets the system-defined color that has an ARGB value of #FFD2B48C.
Public property Static member TealGets the system-defined color that has an ARGB value of #FF008080.
Public property Static member ThistleGets the system-defined color that has an ARGB value of #FFD8BFD8.
Public property Static member TomatoGets the system-defined color that has an ARGB value of #FFFF6347.
Public property Static member TransparentGets the system-defined color that has an ARGB value of #00FFFFFF.
Public property Static member TurquoiseGets the system-defined color that has an ARGB value of #FF40E0D0.
Public property Static member VioletGets the system-defined color that has an ARGB value of #FFEE82EE.
Public property Static member WheatGets the system-defined color that has an ARGB value of #FFF5DEB3.
Public property Static member WhiteGets the system-defined color that has an ARGB value of #FFFFFFFF.
Public property Static member WhiteSmokeGets the system-defined color that has an ARGB value of #FFF5F5F5.
Public property Static member YellowGets the system-defined color that has an ARGB value of #FFFFFF00.
Public property Static member YellowGreenGets the system-defined color that has an ARGB value of #FF9ACD32.
Top
Methods
  NameDescription
Public method Equals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method GetHashCodeServes as the default hash function. (Inherited from Object.)
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Public method ToStringReturns a string that represents the current object. (Inherited from Object.)
Top
Remarks

The Windows Presentation Foundation (WPF) color names match the Microsoft .NET Framework version 1.0, Windows Forms, and Microsoft Internet Explorer color names. This representation is based on UNIX X11 named color values.

The following image shows each predefined color, its name, and its hexadecimal value.

Color Table including a color swatch, the color name, and the hexadecimal value

Predefined colors

See the Brush class for a variety of other more complex ways you can color an area, including gradients ( LinearGradientBrush, RadialGradientBrush) or images ( ImageBrush).

Examples

To paint an area with a solid color, you can use a predefined system brush, such as Red or Blue, or you can create a new SolidColorBrush and describe its Color using alpha, red, green, and blue values. In XAML, you may also paint an area with a solid color by using hexidecimal notation.

The following examples uses each of these techniques to paint a Rectangle blue.

Using a Predefined Brush

In the following example uses the predefined brush Blue to paint a rectangle blue.

<Rectangle Width="50" Height="50" Fill="Blue" />
			' Create a rectangle and paint it with
			' a predefined brush.
			Dim myPredefinedBrushRectangle As New Rectangle()
			myPredefinedBrushRectangle.Width = 50
			myPredefinedBrushRectangle.Height = 50
			myPredefinedBrushRectangle.Fill = Brushes.Blue
// Create a rectangle and paint it with 
// a predefined brush.
Rectangle myPredefinedBrushRectangle = new Rectangle();
myPredefinedBrushRectangle.Width = 50;
myPredefinedBrushRectangle.Height = 50;
myPredefinedBrushRectangle.Fill = Brushes.Blue;

Using Hexadecimal Notation

The next example uses 8-digit hexadecimal notation to paint a rectangle blue.

<!-- Note that the first two characters "FF" of the 8-digit
     value is the alpha which controls the transparency of 
     the color. Therefore, to make a completely transparent
     color (invisible), use "00" for those digits (e.g. #000000FF). -->
<Rectangle Width="50" Height="50" Fill="#FF0000FF" />

Using ARGB Values

The next example creates a SolidColorBrush and describes its Color using the ARGB values for the color blue.

<Rectangle Width="50" Height="50">
  <Rectangle.Fill>
    <SolidColorBrush>
     <SolidColorBrush.Color>

        <!-- Describes the brush's color using
             RGB values. Each value has a range of 0-255.  
             R is for red, G is for green, and B is for blue.
             A is for alpha which controls transparency of the
             color. Therefore, to make a completely transparent
             color (invisible), use a value of 0 for Alpha. -->
        <Color A="255" R="0" G="0" B="255" />
     </SolidColorBrush.Color>
    </SolidColorBrush>
  </Rectangle.Fill>
</Rectangle>
			Dim myRgbRectangle As New Rectangle()
			myRgbRectangle.Width = 50
			myRgbRectangle.Height = 50
			Dim mySolidColorBrush As New SolidColorBrush()

			' Describes the brush's color using RGB values. 
			' Each value has a range of 0-255.
			mySolidColorBrush.Color = Color.FromArgb(255, 0, 0, 255)
			myRgbRectangle.Fill = mySolidColorBrush
Rectangle myRgbRectangle = new Rectangle();
myRgbRectangle.Width = 50;
myRgbRectangle.Height = 50;
SolidColorBrush mySolidColorBrush = new SolidColorBrush();

// Describes the brush's color using RGB values.  
// Each value has a range of 0-255.
mySolidColorBrush.Color = Color.FromArgb(255, 0, 0, 255);
myRgbRectangle.Fill = mySolidColorBrush;           

For other ways of describing color, see the Color structure.

Related Topics

For more information about SolidColorBrush and additional examples, see the Painting with Solid Colors and Gradients Overview overview.

This code example is part of a larger example provided for the SolidColorBrush class. For the complete sample, see the Brushes Sample.

Version Information

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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