# Class: Stroke

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

## ol/style/Stroke~Stroke

    import Stroke from 'ol/style/Stroke.js';

Set stroke style for vector features. Note that the defaults given are the Canvas defaults, which will be used if option is not defined. The `get` functions return whatever was entered in the options; they will not return the default.

#### new Stroke(options)

style/Stroke.js, line 28

  Name | Type | Description
  --- | --- | ---
  `color` | Color | ColorLike | undefined | A color, gradient or pattern. See `Color` and `ColorLike` for possible formats. Default null; if null, the Canvas/renderer default black will be used.
  `lineCap` | CanvasLineCap (defaults to 'round') | Line cap style: `butt`, `round`, or `square`.
  `lineJoin` | CanvasLineJoin (defaults to 'round') | Line join style: `bevel`, `round`, or `miter`.
  `lineDash` | Array.<number> | undefined | Line dash pattern. Default is `null` (no dash).
  `lineDashOffset` | number (defaults to 0) | Line dash offset.
  `miterLimit` | number (defaults to 10) | Miter limit.
  `offset` | number | undefined | Line offset in pixels along the normal. A positive value offsets the line to the right, relative to the direction of the line. Default is `undefined` (no offset).
  `width` | number | undefined | Width.

### Methods

#### clone(){Stroke}

style/Stroke.js, line 89

  Clones the style.

  ##### Returns:

  The cloned style.

#### getColor(){Color | ColorLike}

style/Stroke.js, line 108

  Get the stroke color.

  ##### Returns:

  Color.

#### getLineCap(){CanvasLineCap | undefined}

style/Stroke.js, line 117

  Get the line cap type for the stroke.

  ##### Returns:

  Line cap.

#### getLineDash(){Array.<number> | null}

style/Stroke.js, line 126

  Get the line dash style for the stroke.

  ##### Returns:

  Line dash.

#### getLineDashOffset(){number | undefined}

style/Stroke.js, line 135

  Get the line dash offset for the stroke.

  ##### Returns:

  Line dash offset.

#### getLineJoin(){CanvasLineJoin | undefined}

style/Stroke.js, line 144

  Get the line join type for the stroke.

  ##### Returns:

  Line join.

#### getMiterLimit(){number | undefined}

style/Stroke.js, line 153

  Get the miter limit for the stroke.

  ##### Returns:

  Miter limit.

#### getOffset(){number | undefined}

style/Stroke.js, line 162

  Get the line offset in pixels.

  ##### Returns:

  Offset.

#### getWidth(){number | undefined}

style/Stroke.js, line 171

  Get the stroke width.

  ##### Returns:

  Width.

#### setColor(color)

style/Stroke.js, line 181

  Set the color.

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

#### setLineCap(lineCap)

style/Stroke.js, line 191

  Set the line cap.

  Name | Type | Description
  --- | --- | ---
  `lineCap` | CanvasLineCap | undefined | Line cap.

#### setLineDash(lineDash)

style/Stroke.js, line 201

  Set the line dash.

  Name | Type | Description
  --- | --- | ---
  `lineDash` | Array.<number> | null | Line dash.

#### setLineDashOffset(lineDashOffset)

style/Stroke.js, line 211

  Set the line dash offset.

  Name | Type | Description
  --- | --- | ---
  `lineDashOffset` | number | undefined | Line dash offset.

#### setLineJoin(lineJoin)

style/Stroke.js, line 221

  Set the line join.

  Name | Type | Description
  --- | --- | ---
  `lineJoin` | CanvasLineJoin | undefined | Line join.

#### setMiterLimit(miterLimit)

style/Stroke.js, line 231

  Set the miter limit.

  Name | Type | Description
  --- | --- | ---
  `miterLimit` | number | undefined | Miter limit.

#### setOffset(offset)

style/Stroke.js, line 241

  Set the line offset in pixels.

  Name | Type | Description
  --- | --- | ---
  `offset` | number | undefined | Offset.

#### setWidth(width)

style/Stroke.js, line 251

  Set the width.

  Name | Type | Description
  --- | --- | ---
  `width` | number | undefined | Width.