AI-generated Key Takeaways
-
SpreadsheetTheme allows access and modification of existing spreadsheet themes.
-
You can set a theme on a spreadsheet using
Spreadsheet.setSpreadsheetTheme(theme). -
Methods are available to get and set concrete colors for theme color types and to get and set the font family of a theme.
-
Methods like
getConcreteColorandgetFontFamilyreturn theme properties, while methods likesetConcreteColorandsetFontFamilymodify them and return the theme object for chaining. -
Using these methods requires specific authorization scopes related to accessing and modifying spreadsheets.
Access and modify existing themes. To set a theme on a spreadsheet, use Spreadsheet.setSpreadsheetTheme(theme).
Methods
| Method | Return type | Brief description |
|---|---|---|
get | Color | Returns the concrete Color for a valid theme color type. |
get | String | Returns the font family of the theme, or null if it's a null theme. |
get | Theme | Returns a list of all possible theme color types for the current theme. |
set | Spreadsheet | Sets the concrete color associated with the Theme in this color scheme to the
given color. |
set | Spreadsheet | Sets the concrete color associated with the Theme in this color scheme to the
given color in RGB format. |
set | Spreadsheet | Sets the font family for the theme. |
Detailed documentation
getConcreteColor(themeColorType)
Returns the concrete Color for a valid theme color type. Throws exception if the theme
color type is not set in the current theme.
Parameters
| Name | Type | Description |
|---|---|---|
theme | Theme | Theme color type. |
Return
Color — Concrete color.
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
getFontFamily()
Returns the font family of the theme, or null if it's a null theme.
Return
String — The theme font family.
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
getThemeColors()
Returns a list of all possible theme color types for the current theme.
Return
Theme — A list of theme colors.
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
setConcreteColor(themeColorType, color)
Sets the concrete color associated with the Theme in this color scheme to the
given color.
Parameters
| Name | Type | Description |
|---|---|---|
theme | Theme | The theme color type. |
color | Color | The color. |
Return
Spreadsheet — The theme, for chaining.
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
setConcreteColor(themeColorType, red, green, blue)
Sets the concrete color associated with the Theme in this color scheme to the
given color in RGB format.
Parameters
| Name | Type | Description |
|---|---|---|
theme | Theme | The theme color type. |
red | Integer | The value of red channel. |
green | Integer | The value of green channel. |
blue | Integer | The value of blue channel. |
Return
Spreadsheet — The theme, for chaining.
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
setFontFamily(fontFamily)
Sets the font family for the theme.
Parameters
| Name | Type | Description |
|---|---|---|
font | String | The new theme font family. |
Return
Spreadsheet — This theme, for chaining.
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