ThemeColor

ThemeColor class

Represents a theme color.

class ThemeColor;

Example

const { Workbook, ThemeColor, ThemeColorType, BackgroundType } = require("aspose.cells.node");

//Instantiating a Workbook object
var workbook = new Workbook();
var cells = workbook.getWorksheets().get(0).getCells();
cells.get("A1").putValue("Hello World");
var style = cells.get("A1").getStyle();
//Set ThemeColorType.Text2 color type with 40% lighten as the font color.
style.getFont().setThemeColor(new ThemeColor(ThemeColorType.Text2, 0.4));
style.setPattern(BackgroundType.Solid);
//Set ThemeColorType.Background2 color type with 75% darken as the foreground color
style.setForegroundThemeColor(new ThemeColor(ThemeColorType.Background2, -0.75));
cells.get("A1").setStyle(style);
//Saving the Excel file
workbook.save("output/ThemeColor.xlsx");

Constructors

NameDescription
constructor(ThemeColorType, number)

Methods

MethodDescription
getColorType()Gets and sets the theme type.
setColorType(ThemeColorType)Gets and sets the theme type.
getTint()Gets and sets the tint value.
setTint(number)Gets and sets the tint value.
isNull()Checks whether the implementation object is null.

constructor(ThemeColorType, number)

constructor(type: ThemeColorType, tint: number);

Parameters:

ParameterTypeDescription
typeThemeColorTypeThe theme type.
tintnumberThe tint value.

getColorType()

Gets and sets the theme type.

getColorType() : ThemeColorType;

Returns

ThemeColorType

setColorType(ThemeColorType)

Gets and sets the theme type.

setColorType(value: ThemeColorType) : void;

Parameters:

ParameterTypeDescription
valueThemeColorTypeThe value to set.

getTint()

Gets and sets the tint value.

getTint() : number;

Remarks

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.

setTint(number)

Gets and sets the tint value.

setTint(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

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.

isNull()

Checks whether the implementation object is null.

isNull() : boolean;