Class SpreadsheetColor
Represents a color in a spreadsheet.
Inherited Members
Namespace: DRIT.Spreadsheet.Drawing
Assembly: DRIT.Spreadsheet.dll
Syntax
public class SpreadsheetColor
Constructors
SpreadsheetColor(DrawingColor)
Initializes a new SpreadsheetColor for the supplied workbook data.
Declaration
public SpreadsheetColor(DrawingColor DrawingColor)
Parameters
| Type | Name | Description |
|---|---|---|
| DrawingColor | DrawingColor |
SpreadsheetColor(SpreadsheetColor)
Initializes a new SpreadsheetColor for the supplied workbook data.
Declaration
public SpreadsheetColor(SpreadsheetColor other)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetColor | other |
SpreadsheetColor(Color)
Initializes a new SpreadsheetColor for the supplied workbook data.
Declaration
public SpreadsheetColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color |
SpreadsheetColor(int)
Initializes a new SpreadsheetColor for the supplied workbook data.
Declaration
public SpreadsheetColor(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
SpreadsheetColor(string)
Initializes a new SpreadsheetColor for the supplied workbook data.
Declaration
public SpreadsheetColor(string hexColor)
Parameters
| Type | Name | Description |
|---|---|---|
| string | hexColor |
Properties
Accent1
Gets the accent 1 theme color.
Declaration
public static SpreadsheetColor Accent1 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Accent2
Gets the accent 2 theme color.
Declaration
public static SpreadsheetColor Accent2 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Accent3
Gets the accent 3 theme color.
Declaration
public static SpreadsheetColor Accent3 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Accent4
Gets the accent 4 theme color.
Declaration
public static SpreadsheetColor Accent4 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Accent5
Gets the accent 5 theme color.
Declaration
public static SpreadsheetColor Accent5 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Accent6
Gets the accent 6 theme color.
Declaration
public static SpreadsheetColor Accent6 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Automatic
Gets the automatic color.
Declaration
public static SpreadsheetColor Automatic { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Background1
Gets the background 1 theme color.
Declaration
public static SpreadsheetColor Background1 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Background2
Gets the background 2 theme color.
Declaration
public static SpreadsheetColor Background2 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Black
Gets the black color.
Declaration
public static SpreadsheetColor Black { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Blue
Gets the blue color.
Declaration
public static SpreadsheetColor Blue { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
FollowedHyperlink
Gets the followed hyperlink theme color.
Declaration
public static SpreadsheetColor FollowedHyperlink { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Green
Gets the green color.
Declaration
public static SpreadsheetColor Green { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
HexColor
Gets the hex color string.
Declaration
public string HexColor { get; }
Property Value
| Type | Description |
|---|---|
| string |
Hyperlink
Gets the hyperlink theme color.
Declaration
public static SpreadsheetColor Hyperlink { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Index
Gets the color index.
Declaration
public int? Index { get; }
Property Value
| Type | Description |
|---|---|
| int? |
Red
Gets the red color.
Declaration
public static SpreadsheetColor Red { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Rgb
Gets the ARGB value of the color.
Declaration
public ARgb? Rgb { get; }
Property Value
| Type | Description |
|---|---|
| ARgb? |
Text1
Gets the text 1 theme color.
Declaration
public static SpreadsheetColor Text1 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Text2
Gets the text 2 theme color.
Declaration
public static SpreadsheetColor Text2 { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Theme
Gets the theme color type.
Declaration
public SpreadsheetThemeColor? Theme { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetThemeColor? |
Tint
Specifies the tint value.
Declaration
public decimal Tint { get; set; }
Property Value
| Type | Description |
|---|---|
| decimal |
Type
Exposes the type associated with SpreadsheetColor.
Declaration
public SpreadsheetColorType Type { get; set; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColorType | The type returned by the operation. |
White
Gets the white color.
Declaration
public static SpreadsheetColor White { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Yellow
Gets the yellow color.
Declaration
public static SpreadsheetColor Yellow { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetColor |
Methods
ColorDistance(SpreadsheetColor, SpreadsheetColor)
Calculates the color distance between two colors.
Declaration
public static double ColorDistance(SpreadsheetColor value, SpreadsheetColor color)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetColor | value | The first color. |
| SpreadsheetColor | color | The second color. |
Returns
| Type | Description |
|---|---|
| double | The squared distance value. |
Darken(decimal)
Darkens the color by the specified value.
Declaration
public SpreadsheetColor Darken(decimal value)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | value | The darken value. |
Returns
| Type | Description |
|---|---|
| SpreadsheetColor | The modified color. |
Equals(SpreadsheetColor)
Determines whether the specified color is equal to this color.
Declaration
protected bool Equals(SpreadsheetColor other)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetColor | other | The color to compare. |
Returns
| Type | Description |
|---|---|
| bool | True if equal, false otherwise. |
Equals(object)
Determines whether the specified object is equal to this color.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare. |
Returns
| Type | Description |
|---|---|
| bool | True if equal, false otherwise. |
Overrides
FromArgb(byte, byte, byte, byte)
Converts the supplied data for use with the SpreadsheetColor.
Declaration
public static SpreadsheetColor FromArgb(byte a, byte r, byte g, byte b)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | a | The a used by the operation. |
| byte | r | The r used by the operation. |
| byte | g | The g used by the operation. |
| byte | b | The b used by the operation. |
Returns
| Type | Description |
|---|---|
| SpreadsheetColor | The from argb returned by the operation. |
FromHex(string)
Converts the supplied data for use with the SpreadsheetColor.
Declaration
public static SpreadsheetColor FromHex(string hexColor)
Parameters
| Type | Name | Description |
|---|---|---|
| string | hexColor | The hex color used by the operation. |
Returns
| Type | Description |
|---|---|
| SpreadsheetColor | The from hex returned by the operation. |
FromRgb(byte, byte, byte)
Converts the supplied data for use with the SpreadsheetColor.
Declaration
public static SpreadsheetColor FromRgb(byte r, byte g, byte b)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | r | The r used by the operation. |
| byte | g | The g used by the operation. |
| byte | b | The b used by the operation. |
Returns
| Type | Description |
|---|---|
| SpreadsheetColor | The from rgb returned by the operation. |
GetHashCode()
Gets the hash code for this color.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | The hash code. |
Overrides
Indexed(int)
Creates a color from an indexed color palette.
Declaration
public static SpreadsheetColor Indexed(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The color index. |
Returns
| Type | Description |
|---|---|
| SpreadsheetColor | The created color. |
Lighten(decimal)
Lightens the color by the specified value.
Declaration
public SpreadsheetColor Lighten(decimal value)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | value | The lighten value. |
Returns
| Type | Description |
|---|---|
| SpreadsheetColor | The modified color. |
ToArgb()
Converts the color to ARGB integer value.
Declaration
public int ToArgb()
Returns
| Type | Description |
|---|---|
| int | The ARGB integer value. |
ToColor()
Converts the color to System.Drawing.Color.
Declaration
public Color ToColor()
Returns
| Type | Description |
|---|---|
| Color | The System.Drawing.Color value. |
ToColor(Workbook)
Converts the color to System.Drawing.Color, using workbook theme if needed.
Declaration
public Color ToColor(Workbook workbook)
Parameters
| Type | Name | Description |
|---|---|---|
| Workbook | workbook | The workbook for theme color resolution. |
Returns
| Type | Description |
|---|---|
| Color | The System.Drawing.Color value. |
ToHex()
Converts the color to hex string without alpha.
Declaration
public string ToHex()
Returns
| Type | Description |
|---|---|
| string | The hex string. |
ToHexWithAlpha()
Converts the color to hex string with alpha.
Declaration
public string ToHexWithAlpha()
Returns
| Type | Description |
|---|---|
| string | The hex string with alpha. |
ToHexWithAlpha(Workbook)
Converts the color to hex string with alpha, using workbook theme if needed.
Declaration
public string ToHexWithAlpha(Workbook workbook)
Parameters
| Type | Name | Description |
|---|---|---|
| Workbook | workbook | The workbook for theme color resolution. |
Returns
| Type | Description |
|---|---|
| string | The hex string with alpha. |
ToHexWithAlpha(Color)
Converts a System.Drawing.Color to hex string with alpha.
Declaration
public static string ToHexWithAlpha(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | The color to convert. |
Returns
| Type | Description |
|---|---|
| string | The hex string with alpha. |
ToString()
Gets the string representation of this color.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The string representation. |