GetRGBA
Gets the RGBA components of the color.
Syntax
expression.GetRGBA();
expression - A variable that represents a ApiColor class.
Parameters
This method doesn't have any parameters.
Returns
Object
Example
This example shows how to get the RGBA components of a shape fill color.
- Code
- Result
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);
const rgba = color.GetRGBA();
worksheet.GetRange("A12").SetValue("RGBA: " + rgba.r + ", " + rgba.g + ", " + rgba.b + ", " + rgba.a);