GradientCondition

Access gradient (color) conditions in `https://developers.google.com/apps-script/reference/spreadsheet/conditional-format-rule`.
Each conditional format rule may contain a single gradient condition. A gradient condition is
defined by three points along a number scale (min, mid, and max), each of which has a color, a
value, and a `https://developers.google.com/apps-script/reference/spreadsheet/interpolation-type`. The content of a cell is
compared to the values in the number scale and the color applied to the cell is interpolated
based on the cell content's proximity to the gradient condition min, mid, and max points.

```javascript
// Logs all the information inside gradient conditional format rules on a sheet.
// The below snippet assumes all colors have ColorType.RGB.
const sheet = SpreadsheetApp.getActiveSheet();
const rules = sheet.getConditionalFormatRules();
for (let i = 0; i < rules.length; i++) {
  const gradient = rules[i].getGradientCondition();

  const minColor = gradient.getMinColorObject().asRgbColor().asHexString();
  const minType = gradient.getMinType();
  const minValue = gradient.getMinValue();
  const midColor = gradient.getMidColorObject().asRgbColor().asHexString();
  const midType = gradient.getMidType();
  const midValue = gradient.getMidValue();
  const maxColor = gradient.getMaxColorObject().asRgbColor().asHexString();
  const maxType = gradient.getMaxType();
  const maxValue = gradient.getMaxValue();

  Logger.log(`The conditional format gradient information for rule ${i}:
    MinColor ${minColor}, MinType ${minType}, MinValue ${minValue},
    MidColor ${midColor}, MidType ${midType}, MidValue ${midValue},
    MaxColor ${maxColor}, MaxType ${maxType}, MaxValue ${maxValue}`);
}
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMaxColorObject()` | `https://developers.google.com/apps-script/reference/spreadsheet/color|null` | Gets the color set for the maximum value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMaxType()` | `https://developers.google.com/apps-script/reference/spreadsheet/interpolation-type|null` | Gets the interpolation type for the maximum value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMaxValue()` | `String` | Gets the max value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMidColorObject()` | `https://developers.google.com/apps-script/reference/spreadsheet/color|null` | Gets the color set for the midpoint value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMidType()` | `https://developers.google.com/apps-script/reference/spreadsheet/interpolation-type|null` | Gets the interpolation type for the midpoint value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMidValue()` | `String` | Gets the midpoint value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMinColorObject()` | `https://developers.google.com/apps-script/reference/spreadsheet/color|null` | Gets the color set for the minimum value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMinType()` | `https://developers.google.com/apps-script/reference/spreadsheet/interpolation-type|null` | Gets the interpolation type for the minimum value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMinValue()` | `String` | Gets the minimum value of this gradient condition. |

### Deprecated methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMaxColor()` | `String` | Gets the color set for the maximum value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMidColor()` | `String` | Gets the color set for the midpoint value of this gradient condition. |
| `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMinColor()` | `String` | Gets the color set for the minimum value of this gradient condition. |

## Detailed documentation

### `getMaxColorObject()`

Gets the color set for the maximum value of this gradient condition. Returns `null` if
the color hasn't been set.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/color|null` --- The color set for the maximum value of this gradient condition or `null`.

*** ** * ** ***

### `getMaxType()`

Gets the interpolation type for the maximum value of this gradient condition. Returns `null` if the gradient max type hasn't been set.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/interpolation-type|null` --- The interpolation type for the maximum value of this gradient condition or `null`.

*** ** * ** ***

### `getMaxValue()`

Gets the max value of this gradient condition. Returns an empty string if the `https://developers.google.com/apps-script/reference/spreadsheet/interpolation-type` is `MAX` or if the max value hasn't been
set.

#### Return


`String` --- The maximum value if specified or an empty string.

*** ** * ** ***

### `getMidColorObject()`

Gets the color set for the midpoint value of this gradient condition. Returns `null` if
the color hasn't been set.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/color|null` --- The color set for the midpoint value of this gradient condition or `null`.

*** ** * ** ***

### `getMidType()`

Gets the interpolation type for the midpoint value of this gradient condition. Returns `null` if the gradient mid type hasn't been set.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/interpolation-type|null` --- The interpolation type for the midpoint value of this gradient condition or `null`.

*** ** * ** ***

### `getMidValue()`

Gets the midpoint value of this gradient condition. Returns an empty string if the gradient mid
value hasn't been set.

#### Return


`String` --- The midpoint value or an empty string.

*** ** * ** ***

### `getMinColorObject()`

Gets the color set for the minimum value of this gradient condition. Returns `null` if
the color hasn't been set.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/color|null` --- The color set for the minimum value of this gradient condition or `null`.

*** ** * ** ***

### `getMinType()`

Gets the interpolation type for the minimum value of this gradient condition. Returns `null` if the gradient min type hasn't been set.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/interpolation-type|null` --- The interpolation type for the minimum value of this gradient condition or `null`.

*** ** * ** ***

### `getMinValue()`

Gets the minimum value of this gradient condition. Returns an empty string if the `https://developers.google.com/apps-script/reference/spreadsheet/interpolation-type` is `MIN` or if the min value hasn't been
set.

#### Return


`String` --- The minimum value if specified or an empty string.

## Deprecated methods

### `getMaxColor()`


**Deprecated.** Replaced by `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMaxColorObject()`

Gets the color set for the maximum value of this gradient condition. Returns an empty string if
the color hasn't been set.

#### Return


`String` --- The color set for the maximum value of this gradient condition or an empty string.

*** ** * ** ***

### `getMidColor()`


**Deprecated.** Replaced by `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMidColorObject()`

Gets the color set for the midpoint value of this gradient condition. Returns an empty string
if the color hasn't been set.

#### Return


`String` --- The color set for the midpoint value of this gradient condition or an empty string.

*** ** * ** ***

### `getMinColor()`


**Deprecated.** Replaced by `https://developers.google.com/apps-script/reference/spreadsheet/gradient-condition#getMinColorObject()`

Gets the color set for the minimum value of this gradient condition. Returns an empty string if
the color hasn't been set.

#### Return


`String` --- The color set for the minimum value of this gradient condition or an empty string.