<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# heroPreloadScript

The inline script that preloads the hero's twin for the page's scheme, from the `<head>`, so the browser fetches that twin once. It reads the `dark` class `colorSchemeScript` sets, picks that twin, and adds one `<link rel="preload">` for exactly the source its `<picture>` will use: the first `sources` entry whose `media` matches, or else the twin's own `srcSet` and `sizes`. Use one twin's `priority` instead when most visitors see the same scheme, with no helper.

```tsx
import { heroPreloadScript } from "@/lib/ouro/hero-preload-script";
```

## Example

```tsx
<html lang="en" suppressHydrationWarning>
  <head>
    <script dangerouslySetInnerHTML={{ __html: colorSchemeScript() + heroPreloadScript({ light, dark }) }} />
  </head>
  <body>{children}</body>
</html>
```

## Parameters

| Parameter | Type |
| --- | --- |
| `pictures` | `HeroPreloadPictures` |

## Returns

`string`
