---
title: "alphaOf"
description: "The alpha channel of a color, as a number per pixel."
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#L288"
---

# alphaOf

The alpha channel of a color, as a number per pixel.

```ts
alphaOf(color: PaintSlot): PatternPaint
```

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

## Parameters

| Name | Type | Notes |
|---|---|---|
| `color` | `PaintSlot` |  |

## Example

```ts
paint: withAlpha(streakColor, times(alphaOf(streakColor), streaks.mask))
```

## See also

- [`rgbOf`](/docs/primitives/patterns/rgbof) — The RGB channels of a color, without its alpha.
- [`withAlpha`](/docs/primitives/patterns/withalpha) — A color with its alpha replaced by a separately built mask.

## Used by

[Chevron](/docs/components/chevron), [FallingLines](/docs/components/fallinglines)