---
title: "strokeOver"
description: "Two colors mixed through a mask: `fill` where the mask is 0, `stroke` where it is 1."
group: "paint"
groupTitle: "Painting"
categoryId: "patterns"
categorySlug: "patterns"
categoryTitle: "Patterns & tiling"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/patterns.ts#L140"
---

# strokeOver

Two colors mixed through a mask: `fill` where the mask is 0, `stroke` where it is 1.

```ts
strokeOver(layers: {fill: PaintSlot; stroke: PaintSlot; mask: PaintSlot; space?: PropRef}): PatternPaint
```

Import `patterns` from `shaders/std` and use `patterns.strokeOver`.

The everyday way to color a pattern. `space` is a color-space prop (`'linear'`, `'oklch'`, `'oklab'`, `'hsl'`, `'hsv'`, `'lch'`); leave it out for a linear mix. Alpha interpolates too, so a transparent fill gives a lines-only pattern.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `layers` | `{fill: PaintSlot; stroke: PaintSlot; mask: PaintSlot; space?: PropRef}` |  |

## Example

```ts
paint: strokeOver({fill: p('colorA'), stroke: p('colorB'), mask: checkerCells({cells: p('cells'), softness: p('softness')}), space: p('colorSpace')})
```

> **Tip.** The `space` prop must be `compileTime: true`. Changing it recompiles the shader.

## See also

- [`withAlpha`](/docs/primitives/patterns/withalpha) — A color with its alpha replaced by a separately built mask.
- [`mixOf`](/docs/primitives/patterns/mixof) — A straight blend from one value to another by an amount from 0 to 1.
- [`vary`](/docs/primitives/patterns/vary) — A color lightened or darkened per cell by a shade factor, alpha untouched.

## Used by

[BrickPattern](/docs/components/brickpattern), [Checkerboard](/docs/components/checkerboard), [Chevron](/docs/components/chevron), [FallingLines](/docs/components/fallinglines), [Grid](/docs/components/grid), [HexGrid](/docs/components/hexgrid), [IsometricCubes](/docs/components/isometriccubes), [Ripples](/docs/components/ripples), [Stripes](/docs/components/stripes), [TriangularGrid](/docs/components/triangulargrid), [Truchet](/docs/components/truchet)