Skip to Content

Fine Grain

Fine grain texture: one-octave noise painted on a small tile so it stays crisp on high-density screens instead of clumping. Overlay blend with adjustable opacity; the grain-fine utility comes with it.

Installation

pnpm dlx shadcn@latest add @01orbital/fine-grain

Usage

import { SideGlow } from "@/components/glow/side-glow"
import { Subheading } from "@/components/subheading/subheading"
import { FineGrain } from "@/components/texture/fine-grain"

const COPY = {
  title: "Night notes",
  body: "Written after sundown.",
} as const

export default function FineGrainDemo() {
  return (
    <div className="flex min-h-full w-full flex-1 items-center justify-center p-6">
      <article className="relative isolate flex aspect-4/3 w-full max-w-96 flex-col justify-end overflow-hidden rounded-3xl bg-[oklch(0.372_0.044_257.3)] p-8 text-scene-foreground">
        <SideGlow />
        <FineGrain />
        <div className="relative">
          <Subheading>{COPY.title}</Subheading>
          <p className="mt-3 text-sm/6">{COPY.body}</p>
        </div>
      </article>
    </div>
  )
}

This example installs with everything it uses:

pnpm dlx shadcn@latest add @01orbital/fine-grain-demo

Examples

Indigofine-grain-indigo

Fine Grain Indigo: an example of fine-grain.

pnpm dlx shadcn@latest add @01orbital/fine-grain-indigo

Paperfine-grain-paper

Fine Grain Paper: an example of fine-grain.

pnpm dlx shadcn@latest add @01orbital/fine-grain-paper

API reference

Film grain rather than dirt. SimpleGrain lays two octaves of noise at tile size, which clumps into blotches and blurs when a 2x screen upscales it; this is one octave painted small, so it stays grain at device resolution.

Prop

Type

It also accepts the HTML attributes of the element it renders.

Dependencies

npm: cn. The CLI installs it for you.

Last updated on