---
name: "CanvasContext.setStrokeStyle"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "setStrokeStyle"
---

## CanvasContext.setStrokeStyle

> [VERSION] Base Library >= 2.21.8

### Description

Set stroke color

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `color` | `string \| CanvasGradient` | Yes | Stroke color; supports 6-digit hex, rgb, rgba, color keywords (e.g., red), or a CanvasGradient object |

### Return Value

None


### Examples

#### Set stroke color

```ts
const ctx = ty.createCanvasContext('myCanvas');
ctx.setStrokeStyle('#ff0000');
ctx.strokeRect(10, 10, 150, 75);
ctx.draw();
```
