ColorBuilder

The builder for `https://developers.google.com/apps-script/reference/spreadsheet/color-builder#`. To create a new builder, use `https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#newColor()`.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/spreadsheet/color-builder#asRgbColor()` | `https://developers.google.com/apps-script/reference/base/rgb-color.html` | Converts this color to an `https://developers.google.com/apps-script/reference/base/rgb-color.html`. |
| `https://developers.google.com/apps-script/reference/spreadsheet/color-builder#asThemeColor()` | `https://developers.google.com/apps-script/reference/spreadsheet/theme-color` | Converts this color to a `https://developers.google.com/apps-script/reference/spreadsheet/theme-color`. |
| `https://developers.google.com/apps-script/reference/spreadsheet/color-builder#build()` | `https://developers.google.com/apps-script/reference/spreadsheet/color` | Creates a color object from the settings supplied to the builder. |
| `https://developers.google.com/apps-script/reference/spreadsheet/color-builder#getColorType()` | `https://developers.google.com/apps-script/reference/base/color-type.html` | Get the type of this color. |
| `https://developers.google.com/apps-script/reference/spreadsheet/color-builder#setRgbColor(String)` | `https://developers.google.com/apps-script/reference/spreadsheet/color-builder#` | Sets as RGB color. |
| `https://developers.google.com/apps-script/reference/spreadsheet/color-builder#setThemeColor(ThemeColorType)` | `https://developers.google.com/apps-script/reference/spreadsheet/color-builder#` | Sets as theme color. |

## Detailed documentation

### `asRgbColor()`

Converts this color to an `https://developers.google.com/apps-script/reference/base/rgb-color.html`.

#### Return


`https://developers.google.com/apps-script/reference/base/rgb-color.html` --- The RGB color.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the color is not an `https://developers.google.com/apps-script/reference/base/rgb-color.html`

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/spreadsheets.currentonly`
- `https://www.googleapis.com/auth/spreadsheets`

*** ** * ** ***

### `asThemeColor()`

Converts this color to a `https://developers.google.com/apps-script/reference/spreadsheet/theme-color`.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/theme-color` --- The theme color.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the color is not a `https://developers.google.com/apps-script/reference/spreadsheet/theme-color`.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_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


`https://developers.google.com/apps-script/reference/spreadsheet/color` --- A color object created from this builder.

*** ** * ** ***

### `getColorType()`

Get the type of this color.

#### Return


`https://developers.google.com/apps-script/reference/base/color-type.html` --- The color type.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/spreadsheets.currentonly`
- `https://www.googleapis.com/auth/spreadsheets`

*** ** * ** ***

### `setRgbColor(cssString)`

Sets as RGB color.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `cssString` | `String` | The RGB color in CSS notation (such as '#ffffff'). |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/color-builder#` --- This builder, for chaining.

*** ** * ** ***

### `setThemeColor(themeColorType)`

Sets as theme color.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `themeColorType` | `https://developers.google.com/apps-script/reference/spreadsheet/theme-color-type` | The theme color type. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/color-builder#` --- This builder, for chaining.