AI-generated Key Takeaways
-
ColorBuilder is a builder for creating color objects in Apps Script spreadsheets.
-
A new ColorBuilder is created using SpreadsheetApp.newColor().
-
The builder allows setting a color as either an RGB color using a CSS string or as a theme color using a ThemeColorType.
-
Once configured, the build() method creates the final Color object.
-
You can also convert a built color object to its RgbColor or ThemeColor representation and get its ColorType.
The builder for Color
. To create a new builder, use Spreadsheet
.
Methods
| Method | Return type | Brief description |
|---|---|---|
Rgb
|
Converts this color to an Rgb
. |
|
Theme
|
Converts this color to a Theme
. |
|
Color
|
Creates a color object from the settings supplied to the builder. | |
Color
|
Get the type of this color. | |
Color
|
Sets as RGB color. | |
Color
|
Sets as theme color. |
Detailed documentation
as
Rgb
Color()
Converts this color to an Rgb
.
Return
Rgb
— The RGB color.
Throws
Error
— if the color is not an Rgb
Authorization
Scripts that use this method require authorization with one or more of the following scopes :
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
as
Theme
Color()
Converts this color to a Theme
.
Return
Theme
— The theme color.
Throws
Error
— if the color is not a Theme
.
Authorization
Scripts that use this method require authorization with one or more of the following scopes :
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
build()
Creates a color object from the settings supplied to the builder.
Return
Color
— A color object created from this builder.
get
Color
Type()
Get the type of this color.
Return
Color
— The color type.
Authorization
Scripts that use this method require authorization with one or more of the following scopes :
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
set
Rgb
Color(cssString)
Sets as RGB color.
Parameters
| Name | Type | Description |
|---|---|---|
css
|
String
|
The RGB color in CSS notation (such as '#ffffff'). |
Return
Color
— This builder, for chaining.
set
Theme
Color(themeColorType)
Sets as theme color.
Parameters
| Name | Type | Description |
|---|---|---|
theme
|
Theme
|
The theme color type. |
Return
Color
— This builder, for chaining.

