# Module: ol/color

This documentation is for OpenLayers v10.9.0. The latest is v.

## ol/color

    import * as olColor from 'ol/color';

### Functions

#### asArray(color){Color}

color.js, line 294

      import {asArray} from 'ol/color';

  Return the color as an array. This function maintains a cache of calculated arrays which means the result should not be modified.

  Name | Type | Description
  --- | --- | ---
  `color` | Color | string | Color.

  ##### Returns:

  Color.

#### asString(color){string}

color.js, line 135

      import {asString} from 'ol/color';

  Return the color as an rgba string.

  Name | Type | Description
  --- | --- | ---
  `color` | Color | string | Color.

  ##### Returns:

  Rgba string.

### Type Definitions

#### Color{Array.<number>}

  A color represented as a short array [red, green, blue, alpha]. red, green, and blue should be integers in the range 0..255 inclusive. alpha should be a float in the range 0..1 inclusive. If no alpha value is given then `1` will be used.