# Noise Background

A static grain, film, or paper texture over a soft token gradient that drifts slowly. Pure CSS with one inline SVG noise tile.

- Category: Backgrounds
- Status: stable
- Registry: https://markas.jenderalcorp.com/r/noise-background.json
- CLI: `npx markasui@latest add noise-background`

## When to use

A tactile backdrop for a hero, editorial section, newsletter signup, or video promo.

- Set the background color, padding, and radius with class on the component
- Use variant=film on dark sections and variant=paper behind long reading text
- Keep intensity low behind small text

## Code

### Blade

Save at `resources/views/components/markas/noise-background.blade.php`. No extra dependencies.

```blade
@props([
    'variant' => 'grain',
    'color' => 'primary',
    'intensity' => 'medium',
    'size' => 'medium',
    'speed' => 'normal',
])

@php
    $base = 'relative isolate overflow-hidden';
    $layer = 'pointer-events-none absolute inset-0 overflow-hidden';
    $wash = 'absolute -inset-1/4 animate-[markas-noise-drift_var(--markas-noise-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(36%_42%_at_30%_35%,color-mix(in_oklab,currentColor_26%,transparent),transparent),radial-gradient(40%_40%_at_70%_65%,color-mix(in_oklab,currentColor_16%,transparent),transparent)] motion-reduce:animate-none';
    $grain = 'absolute inset-0 bg-ink opacity-[var(--markas-noise-alpha)] [mask-size:var(--markas-noise-size)]';
    $vignette = 'absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_40%,currentColor)] text-ink/20 dark:text-canvas/85';
    $content = 'relative';
    $textures = [
        'grain' => 'url("data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'200\' height=\'200\'%3E%3Cfilter id=\'n\'%3E%3CfeTurbulence type=\'fractalNoise\' baseFrequency=\'.85\' numOctaves=\'3\' stitchTiles=\'stitch\'/%3E%3CfeColorMatrix values=\'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 -4\'/%3E%3C/filter%3E%3Crect width=\'100%25\' height=\'100%25\' filter=\'url(%23n)\'/%3E%3C/svg%3E")',
        'paper' => 'url("data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'200\' height=\'200\'%3E%3Cfilter id=\'n\'%3E%3CfeTurbulence type=\'fractalNoise\' baseFrequency=\'.5 .12\' numOctaves=\'4\' stitchTiles=\'stitch\'/%3E%3CfeColorMatrix values=\'0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 -1.7\'/%3E%3C/filter%3E%3Crect width=\'100%25\' height=\'100%25\' filter=\'url(%23n)\'/%3E%3C/svg%3E")',
    ];
    $variants = [
        'grain' => $textures['grain'],
        'film' => $textures['grain'],
        'paper' => $textures['paper'],
    ];
    $colors = [
        'primary' => 'text-primary',
        'success' => 'text-success',
        'warning' => 'text-warning',
        'danger' => 'text-danger',
        'muted' => 'text-muted',
    ];
    $intensities = [
        'low' => '[--markas-noise-alpha:0.05]',
        'medium' => '[--markas-noise-alpha:0.09]',
        'high' => '[--markas-noise-alpha:0.15]',
    ];
    $sizes = [
        'fine' => '[--markas-noise-size:120px]',
        'medium' => '[--markas-noise-size:200px]',
        'coarse' => '[--markas-noise-size:320px]',
    ];
    $speeds = [
        'slow' => '[--markas-noise-speed:30s]',
        'normal' => '[--markas-noise-speed:18s]',
        'fast' => '[--markas-noise-speed:10s]',
    ];
    $keyframes = '@keyframes markas-noise-drift{to{transform:translate(-6%,4%) rotate(4deg) scale(1.08)}}';
@endphp

<div {{ $attributes->class([$base]) }}>
    <style>{!! $keyframes !!}</style>
    <div aria-hidden="true" @class([$layer, $colors[$color] ?? $colors['primary'], $intensities[$intensity] ?? $intensities['medium'], $sizes[$size] ?? $sizes['medium'], $speeds[$speed] ?? $speeds['normal']])>
        <div class="{{ $wash }}"></div>
        <div class="{{ $grain }}" style="mask-image: {{ $variants[$variant] ?? $variants['grain'] }}"></div>
        @if ($variant === 'film')
            <div class="{{ $vignette }}"></div>
        @endif
    </div>
    <div class="{{ $content }}">{{ $slot }}</div>
</div>
```

```blade
<x-markas.noise-background color="warning" class="rounded-xl border border-line bg-surface px-6 py-14">
    <h2 class="text-3xl font-semibold text-ink">Design tools with a little texture</h2>
    <x-markas.button>Download the kit</x-markas.button>
</x-markas.noise-background>
```

No JavaScript or Alpine.js needed.

### React

Save at `src/components/markas/NoiseBackground.tsx`. No extra dependencies.

```tsx
import type { ComponentProps } from "react";

const base = "relative isolate overflow-hidden";
const layer = "pointer-events-none absolute inset-0 overflow-hidden";
const wash =
  "absolute -inset-1/4 animate-[markas-noise-drift_var(--markas-noise-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(36%_42%_at_30%_35%,color-mix(in_oklab,currentColor_26%,transparent),transparent),radial-gradient(40%_40%_at_70%_65%,color-mix(in_oklab,currentColor_16%,transparent),transparent)] motion-reduce:animate-none";
const grain =
  "absolute inset-0 bg-ink opacity-[var(--markas-noise-alpha)] [mask-size:var(--markas-noise-size)]";
const vignette =
  "absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_40%,currentColor)] text-ink/20 dark:text-canvas/85";
const content = "relative";
const textures = {
  grain:
    "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 -4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
  paper:
    "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5 .12' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 -1.7'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
};
const variants = {
  grain: textures.grain,
  film: textures.grain,
  paper: textures.paper,
};
const colors = {
  primary: "text-primary",
  success: "text-success",
  warning: "text-warning",
  danger: "text-danger",
  muted: "text-muted",
};
const intensities = {
  low: "[--markas-noise-alpha:0.05]",
  medium: "[--markas-noise-alpha:0.09]",
  high: "[--markas-noise-alpha:0.15]",
};
const sizes = {
  fine: "[--markas-noise-size:120px]",
  medium: "[--markas-noise-size:200px]",
  coarse: "[--markas-noise-size:320px]",
};
const speeds = {
  slow: "[--markas-noise-speed:30s]",
  normal: "[--markas-noise-speed:18s]",
  fast: "[--markas-noise-speed:10s]",
};
const keyframes =
  "@keyframes markas-noise-drift{to{transform:translate(-6%,4%) rotate(4deg) scale(1.08)}}";
const cx = (...c: (string | false | null | undefined)[]) =>
  c.filter(Boolean).join(" ");

export type NoiseBackgroundProps = ComponentProps<"div"> & {
  /** grain: fine grain; film: stronger grain with a vignette; paper: soft paper fibers. */
  variant?: keyof typeof variants;
  color?: keyof typeof colors;
  intensity?: keyof typeof intensities;
  /** Size of one grain tile: smaller is finer. */
  size?: keyof typeof sizes;
  speed?: keyof typeof speeds;
};

export function NoiseBackground({
  variant = "grain",
  color = "primary",
  intensity = "medium",
  size = "medium",
  speed = "normal",
  className,
  children,
  ...props
}: NoiseBackgroundProps) {
  return (
    <div {...props} className={cx(base, className)}>
      <style>{keyframes}</style>
      <div
        aria-hidden="true"
        className={cx(
          layer,
          colors[color],
          intensities[intensity],
          sizes[size],
          speeds[speed],
        )}
      >
        <div className={wash} />
        <div
          className={grain}
          style={{ maskImage: variants[variant] ?? variants.grain }}
        />
        {variant === "film" && <div className={vignette} />}
      </div>
      <div className={content}>{children}</div>
    </div>
  );
}
```

```tsx
import { Button } from "@/components/markas/Button";
import { NoiseBackground } from "@/components/markas/NoiseBackground";

<NoiseBackground
  color="warning"
  className="rounded-xl border border-line bg-surface px-6 py-14"
>
  <h2 className="text-3xl font-semibold text-ink">
    Design tools with a little texture
  </h2>
  <Button>Download the kit</Button>
</NoiseBackground>;
```

### Vue

Save at `src/components/markas/NoiseBackground.vue`. No extra dependencies.

```vue
<script setup lang="ts">
const base = "relative isolate overflow-hidden";
const layer = "pointer-events-none absolute inset-0 overflow-hidden";
const wash =
  "absolute -inset-1/4 animate-[markas-noise-drift_var(--markas-noise-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(36%_42%_at_30%_35%,color-mix(in_oklab,currentColor_26%,transparent),transparent),radial-gradient(40%_40%_at_70%_65%,color-mix(in_oklab,currentColor_16%,transparent),transparent)] motion-reduce:animate-none";
const grain =
  "absolute inset-0 bg-ink opacity-[var(--markas-noise-alpha)] [mask-size:var(--markas-noise-size)]";
const vignette =
  "absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_40%,currentColor)] text-ink/20 dark:text-canvas/85";
const content = "relative";
const textures = {
  grain:
    "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 -4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
  paper:
    "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5 .12' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 -1.7'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
};
const variants = {
  grain: textures.grain,
  film: textures.grain,
  paper: textures.paper,
};
const colors = {
  primary: "text-primary",
  success: "text-success",
  warning: "text-warning",
  danger: "text-danger",
  muted: "text-muted",
};
const intensities = {
  low: "[--markas-noise-alpha:0.05]",
  medium: "[--markas-noise-alpha:0.09]",
  high: "[--markas-noise-alpha:0.15]",
};
const sizes = {
  fine: "[--markas-noise-size:120px]",
  medium: "[--markas-noise-size:200px]",
  coarse: "[--markas-noise-size:320px]",
};
const speeds = {
  slow: "[--markas-noise-speed:30s]",
  normal: "[--markas-noise-speed:18s]",
  fast: "[--markas-noise-speed:10s]",
};
const keyframes =
  "@keyframes markas-noise-drift{to{transform:translate(-6%,4%) rotate(4deg) scale(1.08)}}";

const props = withDefaults(
  defineProps<{
    /** grain: fine grain; film: stronger grain with a vignette; paper: soft paper fibers. */
    variant?: keyof typeof variants;
    color?: keyof typeof colors;
    intensity?: keyof typeof intensities;
    /** Size of one grain tile: smaller is finer. */
    size?: keyof typeof sizes;
    speed?: keyof typeof speeds;
  }>(),
  {
    variant: "grain",
    color: "primary",
    intensity: "medium",
    size: "medium",
    speed: "normal",
  },
);
</script>

<template>
  <div :class="base">
    <component :is="'style'">{{ keyframes }}</component>
    <div
      aria-hidden="true"
      :class="[
        layer,
        colors[props.color],
        intensities[props.intensity],
        sizes[props.size],
        speeds[props.speed],
      ]"
    >
      <div :class="wash" />
      <div
        :class="grain"
        :style="{ maskImage: variants[props.variant] ?? variants.grain }"
      />
      <div v-if="props.variant === 'film'" :class="vignette" />
    </div>
    <div :class="content"><slot /></div>
  </div>
</template>
```

```vue
<template>
  <NoiseBackground
    color="warning"
    class="rounded-xl border border-line bg-surface px-6 py-14"
  >
    <h2 class="text-3xl font-semibold text-ink">
      Design tools with a little texture
    </h2>
    <Button>Download the kit</Button>
  </NoiseBackground>
</template>
```

### Svelte

Save at `src/lib/components/markas/NoiseBackground.svelte`. No extra dependencies.

```svelte
<script lang="ts">
  import type { Snippet } from "svelte";
  import type { HTMLAttributes } from "svelte/elements";

  const base = "relative isolate overflow-hidden";
  const layer = "pointer-events-none absolute inset-0 overflow-hidden";
  const wash =
    "absolute -inset-1/4 animate-[markas-noise-drift_var(--markas-noise-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(36%_42%_at_30%_35%,color-mix(in_oklab,currentColor_26%,transparent),transparent),radial-gradient(40%_40%_at_70%_65%,color-mix(in_oklab,currentColor_16%,transparent),transparent)] motion-reduce:animate-none";
  const grain =
    "absolute inset-0 bg-ink opacity-[var(--markas-noise-alpha)] [mask-size:var(--markas-noise-size)]";
  const vignette =
    "absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_40%,currentColor)] text-ink/20 dark:text-canvas/85";
  const content = "relative";
  const textures = {
    grain:
      "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 -4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
    paper:
      "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5 .12' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 -1.7'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
  };
  const variants = {
    grain: textures.grain,
    film: textures.grain,
    paper: textures.paper,
  };
  const colors = {
    primary: "text-primary",
    success: "text-success",
    warning: "text-warning",
    danger: "text-danger",
    muted: "text-muted",
  };
  const intensities = {
    low: "[--markas-noise-alpha:0.05]",
    medium: "[--markas-noise-alpha:0.09]",
    high: "[--markas-noise-alpha:0.15]",
  };
  const sizes = {
    fine: "[--markas-noise-size:120px]",
    medium: "[--markas-noise-size:200px]",
    coarse: "[--markas-noise-size:320px]",
  };
  const speeds = {
    slow: "[--markas-noise-speed:30s]",
    normal: "[--markas-noise-speed:18s]",
    fast: "[--markas-noise-speed:10s]",
  };
  const keyframes =
    "@keyframes markas-noise-drift{to{transform:translate(-6%,4%) rotate(4deg) scale(1.08)}}";

  type Props = HTMLAttributes<HTMLDivElement> & {
    /** grain: fine grain; film: stronger grain with a vignette; paper: soft paper fibers. */
    variant?: keyof typeof variants;
    color?: keyof typeof colors;
    intensity?: keyof typeof intensities;
    /** Size of one grain tile: smaller is finer. */
    size?: keyof typeof sizes;
    speed?: keyof typeof speeds;
    children?: Snippet;
  };

  let {
    variant = "grain",
    color = "primary",
    intensity = "medium",
    size = "medium",
    speed = "normal",
    class: className,
    children,
    ...rest
  }: Props = $props();
</script>

<div {...rest} class={[base, className]}>
  {@html `<style>${keyframes}</style>`}
  <div
    aria-hidden="true"
    class={[
      layer,
      colors[color],
      intensities[intensity],
      sizes[size],
      speeds[speed],
    ]}
  >
    <div class={wash}></div>
    <div
      class={grain}
      style:mask-image={variants[variant] ?? variants.grain}
    ></div>
    {#if variant === "film"}<div class={vignette}></div>{/if}
  </div>
  <div class={content}>{@render children?.()}</div>
</div>
```

```svelte
<script lang="ts">
  import Button from "$lib/components/markas/Button.svelte";
  import NoiseBackground from "$lib/components/markas/NoiseBackground.svelte";
</script>

<NoiseBackground
  color="warning"
  class="rounded-xl border border-line bg-surface px-6 py-14"
>
  <h2 class="text-3xl font-semibold text-ink">
    Design tools with a little texture
  </h2>
  <Button>Download the kit</Button>
</NoiseBackground>
```

### Astro

Save at `src/components/markas/NoiseBackground.astro`. No extra dependencies.

```astro
---
import type { HTMLAttributes } from "astro/types";

const base = "relative isolate overflow-hidden";
const layer = "pointer-events-none absolute inset-0 overflow-hidden";
const wash =
  "absolute -inset-1/4 animate-[markas-noise-drift_var(--markas-noise-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(36%_42%_at_30%_35%,color-mix(in_oklab,currentColor_26%,transparent),transparent),radial-gradient(40%_40%_at_70%_65%,color-mix(in_oklab,currentColor_16%,transparent),transparent)] motion-reduce:animate-none";
const grain =
  "absolute inset-0 bg-ink opacity-[var(--markas-noise-alpha)] [mask-size:var(--markas-noise-size)]";
const vignette =
  "absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_40%,currentColor)] text-ink/20 dark:text-canvas/85";
const content = "relative";
const textures = {
  grain:
    "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 -4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
  paper:
    "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5 .12' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 -1.7'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
};
const variants = {
  grain: textures.grain,
  film: textures.grain,
  paper: textures.paper,
};
const colors = {
  primary: "text-primary",
  success: "text-success",
  warning: "text-warning",
  danger: "text-danger",
  muted: "text-muted",
};
const intensities = {
  low: "[--markas-noise-alpha:0.05]",
  medium: "[--markas-noise-alpha:0.09]",
  high: "[--markas-noise-alpha:0.15]",
};
const sizes = {
  fine: "[--markas-noise-size:120px]",
  medium: "[--markas-noise-size:200px]",
  coarse: "[--markas-noise-size:320px]",
};
const speeds = {
  slow: "[--markas-noise-speed:30s]",
  normal: "[--markas-noise-speed:18s]",
  fast: "[--markas-noise-speed:10s]",
};
const keyframes =
  "@keyframes markas-noise-drift{to{transform:translate(-6%,4%) rotate(4deg) scale(1.08)}}";

type Props = HTMLAttributes<"div"> & {
  /** grain: fine grain; film: stronger grain with a vignette; paper: soft paper fibers. */
  variant?: keyof typeof variants;
  color?: keyof typeof colors;
  intensity?: keyof typeof intensities;
  /** Size of one grain tile: smaller is finer. */
  size?: keyof typeof sizes;
  speed?: keyof typeof speeds;
};

const {
  variant = "grain",
  color = "primary",
  intensity = "medium",
  size = "medium",
  speed = "normal",
  class: className,
  ...rest
} = Astro.props;
---

<div {...rest} class:list={[base, className]}>
  <style is:inline set:html={keyframes} />
  <div
    aria-hidden="true"
    class:list={[
      layer,
      colors[color],
      intensities[intensity],
      sizes[size],
      speeds[speed],
    ]}
  >
    <div class={wash}></div>
    <div
      class={grain}
      style={{ maskImage: variants[variant] ?? variants.grain }}
    >
    </div>
    {variant === "film" && <div class={vignette} />}
  </div>
  <div class={content}><slot /></div>
</div>
```

```astro
---
import Button from "@/components/markas/Button.astro";
import NoiseBackground from "@/components/markas/NoiseBackground.astro";
---

<NoiseBackground
  color="warning"
  class="rounded-xl border border-line bg-surface px-6 py-14"
>
  <h2 class="text-3xl font-semibold text-ink">
    Design tools with a little texture
  </h2>
  <Button>Download the kit</Button>
</NoiseBackground>
```

### Angular

Save at `src/app/markas/noise-background.component.ts`. No extra dependencies.

```ts
import {
  ChangeDetectionStrategy,
  Component,
  computed,
  input,
  ViewEncapsulation,
} from "@angular/core";

const base = "relative isolate overflow-hidden";
const layer = "pointer-events-none absolute inset-0 overflow-hidden";
const wash =
  "absolute -inset-1/4 animate-[markas-noise-drift_var(--markas-noise-speed)_ease-in-out_infinite_alternate] bg-[radial-gradient(36%_42%_at_30%_35%,color-mix(in_oklab,currentColor_26%,transparent),transparent),radial-gradient(40%_40%_at_70%_65%,color-mix(in_oklab,currentColor_16%,transparent),transparent)] motion-reduce:animate-none";
const grain =
  "absolute inset-0 bg-ink opacity-[var(--markas-noise-alpha)] [mask-size:var(--markas-noise-size)]";
const vignette =
  "absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_40%,currentColor)] text-ink/20 dark:text-canvas/85";
const content = "relative";
const textures = {
  grain:
    "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 -4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
  paper:
    "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5 .12' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 -1.7'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",
};
const variants = {
  grain: textures.grain,
  film: textures.grain,
  paper: textures.paper,
};
const colors = {
  primary: "text-primary",
  success: "text-success",
  warning: "text-warning",
  danger: "text-danger",
  muted: "text-muted",
};
const intensities = {
  low: "[--markas-noise-alpha:0.05]",
  medium: "[--markas-noise-alpha:0.09]",
  high: "[--markas-noise-alpha:0.15]",
};
const sizes = {
  fine: "[--markas-noise-size:120px]",
  medium: "[--markas-noise-size:200px]",
  coarse: "[--markas-noise-size:320px]",
};
const speeds = {
  slow: "[--markas-noise-speed:30s]",
  normal: "[--markas-noise-speed:18s]",
  fast: "[--markas-noise-speed:10s]",
};
const keyframes =
  "@keyframes markas-noise-drift{to{transform:translate(-6%,4%) rotate(4deg) scale(1.08)}}";

/** grain: fine grain; film: stronger grain with a vignette; paper: soft paper fibers. */
export type NoiseBackgroundVariant = keyof typeof variants;
export type NoiseBackgroundColor = keyof typeof colors;
export type NoiseBackgroundIntensity = keyof typeof intensities;
export type NoiseBackgroundSize = keyof typeof sizes;
export type NoiseBackgroundSpeed = keyof typeof speeds;

/**
 * Attribute selector on the native root div: the user's class and attributes stay on it.
 * The keyframes are a global style, so encapsulation is off.
 */
@Component({
  selector: "div[markas-noise-background]",
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
  styles: [keyframes],
  host: { "[class]": "base" },
  template: `
    <div aria-hidden="true" [class]="layerClasses()">
      <div [class]="wash"></div>
      <div [class]="grain" [style.mask-image]="texture()"></div>
      @if (variant() === "film") {
        <div [class]="vignette"></div>
      }
    </div>
    <div [class]="content"><ng-content /></div>
  `,
})
export class NoiseBackground {
  readonly variant = input<NoiseBackgroundVariant>("grain");
  readonly color = input<NoiseBackgroundColor>("primary");
  readonly intensity = input<NoiseBackgroundIntensity>("medium");
  /** Size of one grain tile: smaller is finer. */
  readonly size = input<NoiseBackgroundSize>("medium");
  readonly speed = input<NoiseBackgroundSpeed>("normal");

  protected readonly base = base;
  protected readonly wash = wash;
  protected readonly grain = grain;
  protected readonly vignette = vignette;
  protected readonly content = content;
  protected readonly texture = computed(
    () => variants[this.variant()] ?? variants.grain,
  );
  protected readonly layerClasses = computed(() =>
    [
      layer,
      colors[this.color()],
      intensities[this.intensity()],
      sizes[this.size()],
      speeds[this.speed()],
    ].join(" "),
  );
}
```

```ts
import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import { NoiseBackground } from "./markas/noise-background.component";

@Component({
  selector: "app-kit",
  imports: [Button, NoiseBackground],
  template: `
    <div
      markas-noise-background
      color="warning"
      class="rounded-xl border border-line bg-surface px-6 py-14"
    >
      <h2 class="text-3xl font-semibold text-ink">
        Design tools with a little texture
      </h2>
      <button markas-button>Download the kit</button>
    </div>
  `,
})
export class Kit {}
```

Angular uses an attribute selector on the native div, so `class`, `aria-*`, and other attributes stay on the root element.

## Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `grain \| film \| paper` | grain | grain: fine grain. film: grain with a dark vignette at the edges. paper: soft streaky paper fibers. |
| `color` | `primary \| success \| warning \| danger \| muted` | primary | Token used for the gradient under the texture. |
| `intensity` | `low \| medium \| high` | medium | How visible the texture is. |
| `size` | `fine \| medium \| coarse` | medium | Size of one noise tile: 120px, 200px, or 320px. Larger tiles give coarser grain. |
| `speed` | `slow \| normal \| fast` | normal | How fast the gradient drifts: 30s, 18s, or 10s per cycle. The texture itself never moves. |
| `children / slot` | `slot / ReactNode` | - | Content shown on top of the texture. |

## Accessibility

- The texture layer is aria-hidden and ignores pointer events.
- The grain uses the ink token at low opacity, so ink and muted text keep their contrast.
- With reduced motion, the gradient stops drifting.

## Notes

- The texture is one SVG `feTurbulence` tile inlined as a data URL and used as a CSS mask over the `ink` token, so it follows light and dark mode. The browser renders it once and repeats it.
- Only the gradient under the texture moves, with a slow transform. The grain is static, so there is no per-frame work.
- `variant="film"` adds a vignette that darkens the edges in both themes.
- The component has no built-in text, so there are no label props to translate.
