Table of Contents

Class XmlColor

Namespace
MonoGame.Framework.Content.Pipeline.Builder
Assembly
MonoGame.Framework.Content.Pipeline.dll

Helper for serializing color types with the XmlSerializer.

public class XmlColor
Inheritance
XmlColor
Inherited Members

Constructors

XmlColor()

Creates a new instance of XmlColor with Empty color.

public XmlColor()

XmlColor(Color)

Creates a new instance of XmlColor with provided color

public XmlColor(Color c)

Parameters

c Color

Color to be stored

Properties

Default

Default color value as a string, used for serialization and deserialization.

public string Default { get; set; }

Property Value

string

Methods

FromColor(Color)

Returns a string representation of the supplied Color.

public static string FromColor(Color color)

Parameters

color Color

Color to be converted.

Returns

string

The predefined name of the color, if it's named, or a string in the format "R, G, B, A", if the color is not named, with every component in the [0..255] range.

Remarks

This string value can be used in ToColor(string) to get identical color object.

ToColor(string)

Returns a new Color object from its string representation.

public static Color ToColor(string value)

Parameters

value string

A predefined color name, OR a string in the format "R, G, B, A", where each component is in the [0..255] range.

Returns

Color

Operators

implicit operator Color(XmlColor)

Implicit XmlColor -> Color conversion

public static implicit operator Color(XmlColor x)

Parameters

x XmlColor

Returns

Color

implicit operator XmlColor(Color)

Implicit Color -> XmlColor conversion

public static implicit operator XmlColor(Color c)

Parameters

c Color

Returns

XmlColor