Table of Contents

TExcelColor Record

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

Unit: FlexCel.Core

TExcelColor = record;

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.
Equals Returns true if both instances have the same color.
EqualsAutomatic​IsSame Returns true if both colors are the same, considering all types of automatic as equal.
FromArgb Overloaded
FromArgb(Integer)
FromArgb(Integer, Double)
FromArgb(Byte, Byte, Byte)
FromArgb(Byte, Byte, Byte, Double)
FromAutomatic Returns an standard Automatic color.
FromIndex Overloaded
FromIndex(Integer)
FromIndex(Integer, Double)
FromTheme Overloaded
FromTheme(TThemeColor)
FromTheme(TThemeColor, Double)
GetHashCode Returns the hashcode of the object.
GetHashCodeAutomatic​IsSame Returns a hashcode that is the same for all automatic types. Designed to be used together with EqualsAutomatic​IsSame
ToColor Overloaded
ToColor(TCoreExcelFile)
ToColor(TCoreExcelFile, TUIColor)

Operators

Name Description
Equality Adapts the = operator so it returns true when both instances have the same values.
GreaterThan Adapts the > operator so it returns true when the first parameter is bigger than the second.
Implicit Conversion Overloaded
Implicit conversion from TUIColor to TExcelColor
Implicit conversion from TColor to TExcelColor
Implicit conversion from TAlphaColor to TExcelColor
Inequality Adapts the <> operator so it returns true when both instances have different values.
LessThan Adapts the < operator so it returns true when the first parameter is smaller than the second.

Properties

Name Description
Automatic Returns an standard Automatic color.
AutomaticFillType Returns the type of automatic color, if this structure contains an automatic color.
ColorType Identifies which kind of color is the one to apply in this structure.
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.
IsAutomatic Returns true if this instance has an automatic color.
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(​​TCore​Excel​File) method to find out the RGB color stored in this struct.
...[more]
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.