Table of Contents

TExcelColor Structure

Represents an Excel color. Colors in Excel can be defined in four ways: Automatic Colors, Indexed Colors (for compatibility with Excel 2003 or older), Palette colors, and RGB colors. This Structure is immutable, once you create it you cannot change its members. You need to create a new struct to modify it.

Syntax

Namespace: FlexCel.Core

public struct TExcelColor

Methods

Name Description
CompareTo Returns -1 if obj is more than color, 0 if both colors are the same, and 1 if obj is less than color.
GetHashCode Returns the hashcode of the object.
Equals Returns true if both instances have the same color.
FromArgb Overloaded
FromArgb(Int32)
FromArgb(Int32, Double)
FromArgb(Byte, Byte, Byte)
FromArgb(Byte, Byte, Byte, Double)
FromIndex Overloaded
FromIndex(Int32)
FromIndex(Int32, Double)
FromTheme Overloaded
FromTheme(TThemeColor)
FromTheme(TThemeColor, Double)
FromAutomatic Returns an standard Automatic color.
ToColor Overloaded
ToColor(IFlexCelPalette)
ToColor(IFlexCelPalette, TUIColor)

Operators

Name Description
Equality Returns true if both colors are equal.
Inequality Returns true if both colors do not have the same value.
LessThan Returns true is a color is less than the other.
GreaterThan Returns true is a color is bigger than the other.
Implicit Conversion Overloaded
Implicit conversion from TUIColor to TExcelColor
Implicit conversion from Color to TExcelColor

Properties

Name Description
ColorType Identifies which kind of color is the one to apply in this structure.
RGB Returns the color when this structure has an RGB color, as a 0xRRGGBB integer. This property is fully functional with Excel 2007 or newer, older versions will be converted to Indexed color before saving as xls.




Note: When reading a color, the value here might not be the final one, since Tint is applied to get the final color. Use ToColor(​​IFlexCel​Palette) method to find out the RGB color stored in this struct.
...[more]
AutomaticFillType Returns the type of automatic color, if this structure contains an automatic color.
Index Returns the color when this structure contains an indexed color (1 based). This property is for compatibility with xls files (Excel 2003 or older), but if you are not changing the color palette, even for older files, it is preferred to use RGB or Theme instead.


If you try to read the value of this property and ColorType is not the right kind, an Exception will be raised.
Theme Returns the color if it is one of the entries in the theme palette (1 based).


If you try to read the value of this property and ColorType is not the right kind, an Exception will be raised.
Tint Returns 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.
Automatic Returns an standard Automatic color.
IsAutomatic Returns true if this instance has an automatic color.