Color Class

Text Color.When the object is serialized out as xml, its qualified name is x:color.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Spreadsheet.ColorType
        DocumentFormat.OpenXml.Spreadsheet.Color

Namespace:  DocumentFormat.OpenXml.Spreadsheet
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
Public Class Color _
    Inherits ColorType
'Usage
Dim instance As Color
public class Color : ColorType

Remarks

[ISO/IEC 29500-1 1st Edition]

18.3.1.15 color (Data Bar Color)

One of the colors associated with the data bar or color scale.

The auto attribute shall not be used in the context of data bars.

Parent Elements

bottom (§18.8.6); colorScale (§18.3.1.16); dataBar (§18.3.1.28); diagonal (§18.8.13); end (§18.8.16); font (§18.8.22); horizontal (§18.8.25); mruColors (§18.8.28); rPr (§18.4.7); start (§18.8.37); stop (§18.8.38); top (§18.8.43); vertical (§18.8.44)

Attributes

Description

auto (Automatic)

A boolean value indicating the color is automatic and system color dependent.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

indexed (Index)

Indexed color value. Only used for backwards compatibility. References a color in indexedColors.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

rgb (Alpha Red Green Blue Color Value)

Standard Alpha Red Green Blue color value (ARGB).

The possible values for this attribute are defined by the ST_UnsignedIntHex simple type (§18.18.86).

theme (Theme Color)

A zero-based index into the <clrScheme> collection (§20.1.6.2), referencing a particular <sysClr> or <srgbClr> value expressed in the Theme part.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

tint (Tint)

Specifies the tint value applied to the color.

If tint is supplied, then it is applied to the RGB value of the color to determine the final color applied.

The tint value is stored as a double from -1.0 .. 1.0, where -1.0 means 100% darken and 1.0 means 100% lighten. Also, 0.0 means no change.

In loading the RGB value, it is converted to HLS where HLS values are (0..HLSMAX), where HLSMAX is currently 255.

[Example:

Here are some examples of how to apply tint to color:

If (tint < 0)

Lum’ = Lum * (1.0 + tint)

For example: Lum = 200; tint = -0.5; Darken 50%

Lum‘ = 200 * (0.5) => 100

For example: Lum = 200; tint = -1.0; Darken 100% (make black)

Lum‘ = 200 * (1.0-1.0) => 0

If (tint > 0)

Lum‘ = Lum * (1.0-tint) + (HLSMAX – HLSMAX * (1.0-tint))

For example: Lum = 100; tint = 0.75; Lighten 75%

Lum‘ = 100 * (1-.75) + (HLSMAX – HLSMAX*(1-.75))

= 100 * .25 + (255 – 255 * .25)

= 25 + (255 – 63) = 25 + 192 = 217

For example: Lum = 100; tint = 1.0; Lighten 100% (make white)

Lum‘ = 100 * (1-1) + (HLSMAX – HLSMAX*(1-1))

= 100 * 0 + (255 – 255 * 0)

= 0 + (255 – 0) = 255

end example]

The possible values for this attribute are defined by the W3C XML Schema double datatype.

[Note: The W3C XML Schema definition of this element’s content model (CT_Color) is located in §A.2. end note]

© ISO/IEC29500: 2008.

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.

See Also

Reference

Color Members

DocumentFormat.OpenXml.Spreadsheet Namespace