Color Class
Defines the Color Class.When the object is serialized out as xml, its qualified name is w:color.
Inheritance Hierarchy
System.Object
DocumentFormat.OpenXml.OpenXmlElement
DocumentFormat.OpenXml.OpenXmlLeafElement
DocumentFormat.OpenXml.Wordprocessing.Color
Namespace: DocumentFormat.OpenXml.Wordprocessing
Assembly: DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)
Syntax
'Declaration
Public Class Color _
Inherits OpenXmlLeafElement
'Usage
Dim instance As Color
public class Color : OpenXmlLeafElement
Remarks
[ISO/IEC 29500-1 1st Edition]
17.3.2.6 color (Run Content Color)
This element specifies the color which shall be used to display the contents of this run in the document.
This color can be explicitly specified, or set to allow the consumer to automatically choose an appropriate color based on the background color behind the run's content.
If this element is not present, the default value is to leave the formatting applied at previous level in the style hierarchy. If this element is never applied in the style hierarchy, then the characters are set to allow the consumer to automatically choose an appropriate color based on the background color behind the run's content.
[Example: Consider a run of text which should be displayed using the accent3 theme color from the document’s Theme part. This requirement would be specified as follows in the resulting WordprocessingML:
<w:rPr> <w:color w:themeColor="accent3" /> </w:rPr>
The color attribute specifies that the run shall use the accent3 theme color. end example]
Parent Elements |
---|
rPr (§17.3.1.29); rPr (§17.3.1.30); rPr (§17.5.2.28); rPr (§17.9.25); rPr (§17.7.9.1); rPr (§17.7.5.4); rPr (§17.3.2.28); rPr (§17.5.2.27); rPr (§17.7.6.2); rPr (§17.3.2.27) |
Attributes |
Description |
---|---|
themeColor (Run Content Theme Color) |
Specifies a theme color which should be applied to the current run. The specified theme color is a reference to one of the predefined theme colors, located in the document's Theme part, which allows for color information to be set centrally in the document. If the themeColor attribute is specified, then the val attribute is ignored for this run. [Example: Consider a run of text which should be displayed using the accent3 theme color from the document’s Theme part. This requirement would be specified as follows in the resulting WordprocessingML: <w:rPr> <w:color w:themeColor="accent3" /> </w:rPr> The color attribute specifies that the run must use the accent3 theme color. end example] The possible values for this attribute are defined by the ST_ThemeColor simple type (§17.18.97). |
themeShade (Run Content Theme Color Shade) |
Specifies the shade value applied to the supplied theme color (if any) for this run’s contents. If the themeShade is supplied, then it is applied to the RGB value of the theme color to determine the final color applied to this run. The themeShade value is stored as a hex encoding of the shade value (from 0 to 255) applied to the current border. [Example: Consider a shade of 40% applied to a run in a document. This shade is calculated as follows: Te resulting themeShade value in the file format would be 66. end example] Given a input red, green, or blue color value C (from 0-255), an output color value of C' (from 0-255), and a shade value S (from 0-100), the shade is applied as follows: [Example: Consider a document with a run using the accent6 theme color, whose RGB value (in RRGGBB hex format) is F79646. The hex value for the green component is 96 - 150 in decimal. Applying the shade formula with shade of 50%, the output decimal value of the green component is 75, or a hex value of 4B. This transformed value can be seen in the resulting run color WordprocessingML's val attribute: <w:color w:val="7B4B23" w:themeColor="accent6" w:themeShade="80" /> end example] The possible values for this attribute are defined by the ST_UcharHexNumber simple type (§17.18.98). |
themeTint (Run Content Theme Color Tint) |
Specifies the tint value applied to the supplied theme color (if any) for this run’s contents. If the themeTint is supplied, then it is applied to the RGB value of the theme color to determine the final color applied to this run. The themeTint value is stored as a hex encoding of the tint value (from 0 to 255) applied to the current border. [Example: Consider a tint of 60% applied to a run in a document. This tint is calculated as follows: The resulting themeTint value in the file format would be 99. end example] Given a input red, green, or blue color value C (from 0-255), an output color value of C' (from 0-255), and a tint value T (from 0-100), the tint is applied as follows: [Example: Consider a document with a run using the accent1 theme color, whose RGB value (in RRGGBB hex format) is C0504D. The hex value for the green component is 50 - 80 in decimal. Applying the tint formula with tint of 60%, the output decimal value of the green component is 150, or a hex value of 96. This transformed value can be seen in the resulting run color's WordprocessingML val attribute: <w:color w:val="D99694" w:themeColor="accent1" w:themeTint="99" /> end example] The possible values for this attribute are defined by the ST_UcharHexNumber simple type (§17.18.98). |
val (Run Content Color) |
Specifies the color for this run. This color can either be presented as a hex value (in RRGGBB format), or auto to allow a consumer to automatically determine the run color as appropriate. If the run specifies the use of a theme color via the themeColor attribute, then this value is superseded by the theme color value. [Example: Consider a run color with value auto, as follows: <w:rPr> <w:color … w:val="auto" /> </w:rPr> This color therefore can be automatically be modified by a consumer as appropriate, for example, in order to ensure that the run contents can be distinguished against the page's background color. end example] The possible values for this attribute are defined by the ST_HexColor simple type (§17.18.38). |
[Note: The W3C XML Schema definition of this element’s content model (CT_Color) is located in §A.1. end note]
[ISO/IEC 29500-1 1st Edition]
17.15.2.5 color (Frameset Splitter Color)
This element specifies the color of the splitters within the frameset in this WordprocessingML document. This element shall only be honored on the root frameset for this document, and can be ignored for all nested framesets in this document.
If this element is omitted, then the default color of the splitter can be automatically determined by the application displaying this WordprocessingML document (equivalent to a val attribute value of auto).
[Example: Consider a frameset consisting of the following three frames:
The following properties define the presentation of the splitter bars within this frameset:
<w:frameset> <w:framesetSplitbar> <w:w w:val="200" /> <w:color w:val="0000FF" /> </w:framesetSplitbar> … </w:frameset>
The color element's val attribute specifies that the splitters must be displayed in the RGB color 0000FF (blue) when the contents of this document are displayed. end example]
Parent Elements |
---|
framesetSplitbar (§17.15.2.20) |
Attributes |
Description |
---|---|
themeColor (Run Content Theme Color) |
Specifies a theme color which should be applied to the current run. The specified theme color is a reference to one of the predefined theme colors, located in the document's Theme part, which allows for color information to be set centrally in the document. If the themeColor attribute is specified, then the val attribute is ignored for this run. [Example: Consider a run of text which should be displayed using the accent3 theme color from the document’s Theme part. This requirement would be specified as follows in the resulting WordprocessingML: <w:rPr> <w:color w:themeColor="accent3" /> </w:rPr> The color attribute specifies that the run must use the accent3 theme color. end example] The possible values for this attribute are defined by the ST_ThemeColor simple type (§17.18.97). |
themeShade (Run Content Theme Color Shade) |
Specifies the shade value applied to the supplied theme color (if any) for this run’s contents. If the themeShade is supplied, then it is applied to the RGB value of the theme color to determine the final color applied to this run. The themeShade value is stored as a hex encoding of the shade value (from 0 to 255) applied to the current border. [Example: Consider a shade of 40% applied to a run in a document. This shade is calculated as follows: Te resulting themeShade value in the file format would be 66. end example] Given a input red, green, or blue color value C (from 0-255), an output color value of C' (from 0-255), and a shade value S (from 0-100), the shade is applied as follows: [Example: Consider a document with a run using the accent6 theme color, whose RGB value (in RRGGBB hex format) is F79646. The hex value for the green component is 96 - 150 in decimal. Applying the shade formula with shade of 50%, the output decimal value of the green component is 75, or a hex value of 4B. This transformed value can be seen in the resulting run color WordprocessingML's val attribute: <w:color w:val="7B4B23" w:themeColor="accent6" w:themeShade="80" /> end example] The possible values for this attribute are defined by the ST_UcharHexNumber simple type (§17.18.98). |
themeTint (Run Content Theme Color Tint) |
Specifies the tint value applied to the supplied theme color (if any) for this run’s contents. If the themeTint is supplied, then it is applied to the RGB value of the theme color to determine the final color applied to this run. The themeTint value is stored as a hex encoding of the tint value (from 0 to 255) applied to the current border. [Example: Consider a tint of 60% applied to a run in a document. This tint is calculated as follows: The resulting themeTint value in the file format would be 99. end example] Given a input red, green, or blue color value C (from 0-255), an output color value of C' (from 0-255), and a tint value T (from 0-100), the tint is applied as follows: [Example: Consider a document with a run using the accent1 theme color, whose RGB value (in RRGGBB hex format) is C0504D. The hex value for the green component is 50 - 80 in decimal. Applying the tint formula with tint of 60%, the output decimal value of the green component is 150, or a hex value of 96. This transformed value can be seen in the resulting run color's WordprocessingML val attribute: <w:color w:val="D99694" w:themeColor="accent1" w:themeTint="99" /> end example] The possible values for this attribute are defined by the ST_UcharHexNumber simple type (§17.18.98). |
val (Run Content Color) |
Specifies the color for this run. This color can either be presented as a hex value (in RRGGBB format), or auto to allow a consumer to automatically determine the run color as appropriate. If the run specifies the use of a theme color via the themeColor attribute, then this value is superseded by the theme color value. [Example: Consider a run color with value auto, as follows: <w:rPr> <w:color … w:val="auto" /> </w:rPr> This color therefore can be automatically be modified by a consumer as appropriate, for example, in order to ensure that the run contents can be distinguished against the page's background color. end example] The possible values for this attribute are defined by the ST_HexColor simple type (§17.18.38). |
[Note: The W3C XML Schema definition of this element’s content model (CT_Color) is located in §A.1. 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.