Sky

A WebGL2 shader of a deep blue sky with soft, smoky clouds. Day in light mode, a starry night in dark mode.

Props
Mode
Day
#1a46c8
Night
#0c1a4a
Cover0.60
Scale1.00
Speed1.0
Grain1.0

Installation

pnpm dlx shadcn@latest add @breeze/sky

Usage

import { Sky } from "@/components/breeze/sky"

It fills a hero as its background. The sky is opaque, deep at the top and paler toward the bottom, with soft, smoky clouds drifting across it. White text sits well on it in both modes. The canvas fills its box: put it in a positioned parent that has a size, as below, or give it a height of its own. In a box with no height it's 0 tall.

The sky fades in once it has drawn, and stays empty where WebGL2 isn't available, so give the section a matching background as a fallback. Otherwise white text sits on your page colour.

<section className="relative isolate overflow-hidden bg-[#1a46c8] dark:bg-[#0c1a4a]">
  <Sky className="absolute inset-0 -z-10 h-full w-full" />
  {/* content */}
</section>

Props

PropTypeDefaultDescription
mode"auto" | "day" | "night""auto""auto" follows the theme: day in light mode, night in dark mode
colorstring"#1a46c8"Daytime sky colour, any CSS colour or var()
nightColorstring"#0c1a4a"Night sky colour, any CSS colour or var()
covernumber0.6How much of the sky is cloud, 0 (clear) to 1 (overcast)
scalenumber1Size of the clouds. Higher is smaller
speednumber1Drift speed multiplier. 0 freezes the sky
starsbooleantrueStars at night
grainnumber1Film grain amount. 0 for a clean finish
fpsnumber30Frame rate cap

Every prop updates live without restarting the animation. The clouds sit on a plane overhead, so they shrink and thicken toward the horizon. In "auto" mode the sky eases from day to night over about a second when the theme changes. At night the clouds turn a moonlit grey-blue and a few stars twinkle behind them. It pauses off-screen and shows a still frame with reduced motion.

Any other canvas prop, like id, style or data-*, is passed to the canvas. It's aria-hidden unless you override it.

Examples

Day and night

Clear evening