# Class ColorBuilder

ColorBuilder

The builder for `ColorBuilder`. To create a new builder, use `SpreadsheetApp.newColor()`.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `asRgbColor()` | `RgbColor` | Converts this color to an `RgbColor`. |
| `asThemeColor()` | `ThemeColor` | Converts this color to a `ThemeColor`. |
| `build()` | `Color` | Creates a color object from the settings supplied to the builder. |
| `getColorType()` | `ColorType` | Get the type of this color. |
| `setRgbColor(cssString)` | `ColorBuilder` | Sets as RGB color. |
| `setThemeColor(themeColorType)` | `ColorBuilder` | Sets as theme color. |

## Detailed documentation

### `asRgbColor()`

Converts this color to an `RgbColor`.

#### Return


`RgbColor` --- The RGB color.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the color is not an `RgbColor`

#### Authorization

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

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

*** ** * ** ***

### `asThemeColor()`

Converts this color to a `ThemeColor`.

#### Return


`ThemeColor` --- The theme color.

#### Throws


[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the color is not a `ThemeColor`.

#### Authorization

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


`Color` --- A color object created from this builder.

*** ** * ** ***

### `getColorType()`

Get the type of this color.

#### Return


`ColorType` --- 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.md.txt#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


`ColorBuilder` --- This builder, for chaining.

*** ** * ** ***

### `setThemeColor(themeColorType)`

Sets as theme color.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `themeColorType` | `ThemeColorType` | The theme color type. |

#### Return


`ColorBuilder` --- This builder, for chaining.