Aspose::Cells::ThemeColor class

ThemeColor class

Represents a theme color.

class ThemeColor

Methods

MethodDescription
GetColorType()Gets and sets the theme type.
GetTint()Gets and sets the tint value.
IsNull() constChecks whether the implementation object is nullptr.
explicit operator bool() constoperator bool()
operator=(const ThemeColor& src)operator=
SetColorType(ThemeColorType value)Gets and sets the theme type.
SetTint(double value)Gets and sets the tint value.
ThemeColor(ThemeColorType type, double tint)
ThemeColor(ThemeColor_Impl* impl)Constructs from an implementation object.
ThemeColor(const ThemeColor& src)Copy constructor.
~ThemeColor()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;
Cells cells = workbook.GetWorksheets().Get(0).GetCells();
cells.Get(u"A1").PutValue(u"Hello World");
Style style = cells.Get(u"A1").GetStyle();
//Set ThemeColorType.Text2 color type with 40% lighten as the font color.
style.GetFont().SetThemeColor(ThemeColor(ThemeColorType::Text2, 0.4));
style.SetPattern(BackgroundType::Solid);
//Set ThemeColorType.Background2 color type with 75% darken as the foreground color
style.SetForegroundThemeColor(ThemeColor(ThemeColorType::Background2, -0.75));
cells.Get(u"A1").SetStyle(style);
//Saving the Excel file
workbook.Save(u"book1.xlsx");

Aspose::Cells::Cleanup();

See Also