Skip to main content

RGBA

Creates an RGBA color from red, green, blue and alpha components.

Syntax

expression.RGBA(r, g, b, a);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
rRequiredbyteRed component (0-255).
gRequiredbyteGreen component (0-255).
bRequiredbyteBlue component (0-255).
aRequiredbyteAlpha component (0-255).

Returns

ApiColor

Example

This example shows how to create an RGBA color and use it as a shape fill.

const worksheet = Api.GetActiveSheet();
const color = Api.RGBA(110, 160, 180, 127);
const fill = Api.CreateSolidFill(color);
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
worksheet.AddShape("rect", 120 * 36000, 70 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);