Skip to main content

XlColor.FromTheme(XlThemeColor, Double) Method

Creates the XlColor object from the theme color using the specified saturation value.

Namespace: DevExpress.Export.Xl

Assembly: DevExpress.Printing.v24.2.Core.dll

Declaration

public static XlColor FromTheme(
    XlThemeColor themeColor,
    double tint
)

Parameters

Name Type Description
themeColor XlThemeColor

An XlThemeColor enumeration member that is one of 12 base colors used by the current document theme.

tint Double

A Double value from -1 to 1.

If a value is outside the allowable range of values, the ArgumentOutOfRangeException will be thrown.

Returns

Type Description
XlColor

An XlColor class instance.

Remarks

The tint parameter value specifies shades (negative values) or tints (positive values) used to darken or lighten the original color, respectively. -1.0 means darken 100% (black) and 1.0 means lighten 100% (white). The zero value corresponds to the original color used at full strength.

The example below demonstrates how to fill the cell background using the color that is 20% lighter than the standard Accent 1 color of the default Office 2013 theme. The XlDocumentTheme enumeration lists the available document themes.

using (IXlCell cell = row.CreateCell())
{
    // Fill the cell background using the theme color.
    XlColor color = XlColor.FromTheme(XlThemeColor.Accent1, 0.2);
    cell.ApplyFormatting(XlFill.SolidFill(color));
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the FromTheme(XlThemeColor, Double) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also