TextStyle

The style of text.

Read methods in this class return `null` if the corresponding `https://developers.google.com/apps-script/reference/slides/text-range` spans
multiple text runs, and those runs have different values for the read method being called. To
avoid this, query for text styles using the `https://developers.google.com/apps-script/reference/slides/text-range`s returned by the `https://developers.google.com/apps-script/reference/slides/text-range#getRuns()` method.

If you use methods that edit how text fits within a shape, any autofit settings applied to the
text styles are deactivated.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/slides/text-style#getBackgroundColor()` | `https://developers.google.com/apps-script/reference/slides/color|null` | Returns the background color of the text, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#getBaselineOffset()` | `https://developers.google.com/apps-script/reference/slides/text-baseline-offset|null` | Returns the vertical offset of text from its normal position, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#getFontFamily()` | `String|null` | Returns the font family of the text, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#getFontSize()` | `Number|null` | Returns the font size of the text in points, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#getFontWeight()` | `Integer|null` | Returns the font weight of the text, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#getForegroundColor()` | `https://developers.google.com/apps-script/reference/slides/color|null` | Returns the foreground color of the text, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#getLink()` | `https://developers.google.com/apps-script/reference/slides/link|null` | Returns the `https://developers.google.com/apps-script/reference/slides/link` on the text, or `null` if there is no link or if the link is on part of the text or if there are multiple links. |
| `https://developers.google.com/apps-script/reference/slides/text-style#hasLink()` | `Boolean|null` | Returns `true` if there is link on the text, `false` if not, or `null` if the link is on part of the text or there are multiple links. |
| `https://developers.google.com/apps-script/reference/slides/text-style#isBackgroundTransparent()` | `Boolean|null` | Returns `true` if the background of the text is transparent, `false` if not, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#isBold()` | `Boolean|null` | Returns `true` if the text is rendered as bold, `false` if not, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#isItalic()` | `Boolean|null` | Returns `true` if the text is italicized, `false` if not, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#isSmallCaps()` | `Boolean|null` | Returns `true` if the text is in small capital letters, `false` if not, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#isStrikethrough()` | `Boolean|null` | Returns `true` if the text is struck through, `false` if not, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#isUnderline()` | `Boolean|null` | Returns `true` if the text is underlined, `false` if not, or `null` if there are multiple styles on the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#removeLink()` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Removes a `https://developers.google.com/apps-script/reference/slides/link`. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setBackgroundColor(Color)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the background color of the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setBackgroundColor(Integer,Integer,Integer)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the background color of the text to the given RGB values from 0 to 255. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setBackgroundColor(String)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the background color of the text to the given hex color string. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setBackgroundColor(ThemeColorType)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the background color of the text to the given `https://developers.google.com/apps-script/reference/slides/theme-color-type`. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setBackgroundColorTransparent()` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the background color of the text to transparent. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setBaselineOffset(TextBaselineOffset)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the vertical offset of the text relative to its normal position. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setBold(Boolean)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets whether the text should be rendered as bold. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setFontFamily(String)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the font family of the text . |
| `https://developers.google.com/apps-script/reference/slides/text-style#setFontFamilyAndWeight(String,Integer)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the font family and weight of the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setFontSize(Number)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the font size of the text, in points. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setForegroundColor(Color)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the foreground color of the text. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setForegroundColor(Integer,Integer,Integer)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the foreground color of the text to the given RGB values from 0 to 255. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setForegroundColor(String)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the foreground color of the text to the given hex color string. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setForegroundColor(ThemeColorType)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the foreground color of the text to the given `https://developers.google.com/apps-script/reference/slides/theme-color-type`. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setItalic(Boolean)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets the whether the text is italicized. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setLinkSlide(Integer)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets a `https://developers.google.com/apps-script/reference/slides/link` to the given `https://developers.google.com/apps-script/reference/slides/slide` using the zero-based index of the slide. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setLinkSlide(Slide)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets a `https://developers.google.com/apps-script/reference/slides/link` to the given `https://developers.google.com/apps-script/reference/slides/slide`, the link is set by the given slide ID. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setLinkSlide(SlidePosition)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets a `https://developers.google.com/apps-script/reference/slides/link` to the given `https://developers.google.com/apps-script/reference/slides/slide` using the relative position of the slide. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setLinkUrl(String)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets a `https://developers.google.com/apps-script/reference/slides/link` to the given non-empty URL string. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setSmallCaps(Boolean)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets whether the text is rendered in small capital letters. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setStrikethrough(Boolean)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets whether the text is struck through. |
| `https://developers.google.com/apps-script/reference/slides/text-style#setUnderline(Boolean)` | `https://developers.google.com/apps-script/reference/slides/text-style#` | Sets whether the text is underlined. |

## Detailed documentation

### `getBackgroundColor()`

Returns the background color of the text, or `null` if there are multiple styles on the
text.

#### Return


`https://developers.google.com/apps-script/reference/slides/color|null` --- The background color of the text.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `getBaselineOffset()`

Returns the vertical offset of text from its normal position, or `null` if there are
multiple styles on the text.

#### Return


`https://developers.google.com/apps-script/reference/slides/text-baseline-offset|null` --- The vertical offset of text from its normal position.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `getFontFamily()`

Returns the font family of the text, or `null` if there are multiple styles on the text.

#### Return


`String|null` --- The font family of the text.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `getFontSize()`

Returns the font size of the text in points, or `null` if there are multiple styles on
the text.

#### Return


`Number|null` --- The font size of the text in points.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `getFontWeight()`

Returns the font weight of the text, or `null` if there are multiple styles on the text.

The weight is a multiple of 100 between 100 and 900, inclusive. This range corresponds to
the numerical values described in the CSS 2.1 Specification, [section 15.6](https://www.w3.org/TR/CSS21/fonts.html#font-boldness), with
non-numerical values disallowed. Weights greater than or equal to 700 are considered bold, in
which case `https://developers.google.com/apps-script/reference/slides/text-style#isBold()` returns `true`. The default value is 400
("normal").

#### Return


`Integer|null` --- The font weight of the text.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `getForegroundColor()`

Returns the foreground color of the text, or `null` if there are multiple styles on the
text.

#### Return


`https://developers.google.com/apps-script/reference/slides/color|null` --- The foreground color of the text.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `getLink()`

Returns the `https://developers.google.com/apps-script/reference/slides/link` on the text, or `null` if there is no link or if the link is on
part of the text or if there are multiple links. Call `https://developers.google.com/apps-script/reference/slides/text-style#hasLink()` to determine whether
the text has no link.

```javascript
const shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];
const textLink = shape.getText().getTextStyle().getLink();
if (textLink != null) {
  Logger.log(`Shape text has a link of type: ${textLink.getLinkType()}`);
}
```

#### Return


`https://developers.google.com/apps-script/reference/slides/link|null` --- The link on the text.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `hasLink()`

Returns `true` if there is link on the text, `false` if not, or `null` if the
link is on part of the text or there are multiple links.

Links cannot be set on newline characters. Therefore, if the `https://developers.google.com/apps-script/reference/slides/text-range` contains a
newline character, this method always returns either `null` or `false`.

#### Return


`Boolean|null` --- Whether there is a link on the text.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `isBackgroundTransparent()`

Returns `true` if the background of the text is transparent, `false` if not, or
`null` if there are multiple styles on the text.

#### Return


`Boolean|null` --- Whether the background of the text is transparent.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `isBold()`

Returns `true` if the text is rendered as bold, `false` if not, or `null` if
there are multiple styles on the text.

#### Return


`Boolean|null` --- Whether the text is rendered as bold.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `isItalic()`

Returns `true` if the text is italicized, `false` if not, or `null` if there
are multiple styles on the text.

#### Return


`Boolean|null` --- Whether the text is italicized.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `isSmallCaps()`

Returns `true` if the text is in small capital letters, `false` if not, or `null` if there are multiple styles on the text.

#### Return


`Boolean|null` --- Whether the text is in small capital letters.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `isStrikethrough()`

Returns `true` if the text is struck through, `false` if not, or `null` if
there are multiple styles on the text.

#### Return


`Boolean|null` --- Whether the text is struck through.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `isUnderline()`

Returns `true` if the text is underlined, `false` if not, or `null` if there
are multiple styles on the text.

#### Return


`Boolean|null` --- Whether the text is underlined.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `removeLink()`

Removes a `https://developers.google.com/apps-script/reference/slides/link`.

Removing a link removes the hyperlink foreground color and underline style on the text. If
possible, these styles are applied to match the text preceding the link.

```javascript
const textRange = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0].getText();
textRange.getTextStyle().removeLink();
```

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

*** ** * ** ***

### `setBackgroundColor(color)`

Sets the background color of the text.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `color` | `https://developers.google.com/apps-script/reference/slides/color` | The background color to set. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setBackgroundColor(red, green, blue)`

Sets the background color of the text to the given RGB values from 0 to 255.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `red` | `Integer` | The red component of the color. |
| `green` | `Integer` | The green component of the color. |
| `blue` | `Integer` | The blue component of the color. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setBackgroundColor(hexColor)`

Sets the background color of the text to the given hex color string.

The hex string must be in the format '#RRGGBB'. For example, pink is represented as

#### Parameters

| Name | Type | Description |
|---|---|---|
| `hexColor` | `String` | The hex color string. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setBackgroundColor(color)`

Sets the background color of the text to the given `https://developers.google.com/apps-script/reference/slides/theme-color-type`.

#### Parameters

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

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setBackgroundColorTransparent()`

Sets the background color of the text to transparent.

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setBaselineOffset(offset)`

Sets the vertical offset of the text relative to its normal position.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `offset` | `https://developers.google.com/apps-script/reference/slides/text-baseline-offset` | The baseline offset to set. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setBold(bold)`

Sets whether the text should be rendered as bold.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `bold` | `Boolean` | Whether to render the text as bold. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setFontFamily(fontFamily)`

Sets the font family of the text .

#### Parameters

| Name | Type | Description |
|---|---|---|
| `fontFamily` | `String` | The font family to set. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setFontFamilyAndWeight(fontFamily, fontWeight)`

Sets the font family and weight of the text.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `fontFamily` | `String` | The font family. |
| `fontWeight` | `Integer` | The font weight. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setFontSize(fontSize)`

Sets the font size of the text, in points.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `fontSize` | `Number` | The font size in points. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setForegroundColor(foregroundColor)`

Sets the foreground color of the text.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `foregroundColor` | `https://developers.google.com/apps-script/reference/slides/color` | The foreground color to set. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setForegroundColor(red, green, blue)`

Sets the foreground color of the text to the given RGB values from 0 to 255.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `red` | `Integer` | The red component of the color. |
| `green` | `Integer` | The green component of the color. |
| `blue` | `Integer` | The blue component of the color. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setForegroundColor(hexColor)`

Sets the foreground color of the text to the given hex color string.

The hex string must be in the format '#RRGGBB'. For example, pink is represented as

#### Parameters

| Name | Type | Description |
|---|---|---|
| `hexColor` | `String` | The hex color string. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setForegroundColor(color)`

Sets the foreground color of the text to the given `https://developers.google.com/apps-script/reference/slides/theme-color-type`.

#### Parameters

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

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setItalic(italic)`

Sets the whether the text is italicized.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `italic` | `Boolean` | Whether to render the text as italic. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setLinkSlide(slideIndex)`

Sets a `https://developers.google.com/apps-script/reference/slides/link` to the given `https://developers.google.com/apps-script/reference/slides/slide` using the zero-based index of the slide.

Setting a link changes the style of the text to be underlined and to have a `https://developers.google.com/apps-script/reference/slides/theme-color-type#HYPERLINK` foreground color. This can be changed via `https://developers.google.com/apps-script/reference/slides/text-style#setForegroundColor(String)` and `https://developers.google.com/apps-script/reference/slides/text-style#setUnderline(Boolean)`.

Since links cannot be set on newline characters, newline characters in the `https://developers.google.com/apps-script/reference/slides/text-range`
are ignored.

```javascript
// Set a link to the first slide of the presentation.
const presentation = SlidesApp.getActivePresentation();
const slide = presentation.getSlides()[0];
const textRange = slide.getShapes()[0].getText();
textRange.getTextStyle().setLinkSlide(0);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `slideIndex` | `Integer` | The zero-based index to the slide. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setLinkSlide(slide)`

Sets a `https://developers.google.com/apps-script/reference/slides/link` to the given `https://developers.google.com/apps-script/reference/slides/slide`, the link is set by the given slide ID.

Setting a link changes the style of the text to be underlined and to have a `https://developers.google.com/apps-script/reference/slides/theme-color-type#HYPERLINK` foreground color. This can be changed via `https://developers.google.com/apps-script/reference/slides/text-style#setForegroundColor(String)` and `https://developers.google.com/apps-script/reference/slides/text-style#setUnderline(Boolean)`.

Since links cannot be set on newline characters, newline characters in the `https://developers.google.com/apps-script/reference/slides/text-range`
are ignored.

```javascript
// Set a link to the first slide of the presentation.
const presentation = SlidesApp.getActivePresentation();
const slide = presentation.getSlides()[0];
const textRange = slide.getShapes()[0].getText();
textRange.getTextStyle().setLinkSlide(slide);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `slide` | `https://developers.google.com/apps-script/reference/slides/slide` | The `https://developers.google.com/apps-script/reference/slides/slide` to be linked. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setLinkSlide(slidePosition)`

Sets a `https://developers.google.com/apps-script/reference/slides/link` to the given `https://developers.google.com/apps-script/reference/slides/slide` using the relative position of the slide.

Setting a link changes the style of the text to be underlined and to have a `https://developers.google.com/apps-script/reference/slides/theme-color-type#HYPERLINK` foreground color. This can be changed via `https://developers.google.com/apps-script/reference/slides/text-style#setForegroundColor(String)` and `https://developers.google.com/apps-script/reference/slides/text-style#setUnderline(Boolean)`.

Since links cannot be set on newline characters, newline characters in the `https://developers.google.com/apps-script/reference/slides/text-range`
are ignored.

```javascript
// Set a link to the first slide of the presentation.
const textRange = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0].getText();
textRange.getTextStyle().setLinkSlide(SlidesApp.SlidePosition.FIRST_SLIDE);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `slidePosition` | `https://developers.google.com/apps-script/reference/slides/slide-position` | The relative `https://developers.google.com/apps-script/reference/slides/slide-position`. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setLinkUrl(url)`

Sets a `https://developers.google.com/apps-script/reference/slides/link` to the given non-empty URL string.

Setting a link changes the style of the text to be underlined and to have a `https://developers.google.com/apps-script/reference/slides/theme-color-type#HYPERLINK` foreground color. This can be changed via `https://developers.google.com/apps-script/reference/slides/text-style#setForegroundColor(String)` and `https://developers.google.com/apps-script/reference/slides/text-style#setUnderline(Boolean)`.

Since links cannot be set on newline characters, newline characters in the `https://developers.google.com/apps-script/reference/slides/text-range`
are ignored.

```javascript
// Set a link to the URL.
const textRange = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0].getText();
textRange.getTextStyle().setLinkUrl('https://slides.google.com');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `url` | `String` | The URL string. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setSmallCaps(smallCaps)`

Sets whether the text is rendered in small capital letters.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `smallCaps` | `Boolean` | Whether to render the text in small capital letters. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setStrikethrough(strikethrough)`

Sets whether the text is struck through.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `strikethrough` | `Boolean` | Whether to strike through the text. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `setUnderline(underline)`

Sets whether the text is underlined.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `underline` | `Boolean` | Whether to underline the text. |

#### Return


`https://developers.google.com/apps-script/reference/slides/text-style#` --- This `https://developers.google.com/apps-script/reference/slides/text-style#`, for chaining.

#### 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/presentations.currentonly`
- `https://www.googleapis.com/auth/presentations`