diff --git a/src/content/docs/en/reference/modules/astro-assets.mdx b/src/content/docs/en/reference/modules/astro-assets.mdx index c7176b70b1de5..c52dcc75491c2 100644 --- a/src/content/docs/en/reference/modules/astro-assets.mdx +++ b/src/content/docs/en/reference/modules/astro-assets.mdx @@ -324,6 +324,33 @@ fetchpriority="high" These individual attributes can still be set manually if you need to customize them further. +#### `background` + +

+ +**Type:** `string | undefined`
+ +

+ +The background color to use when flattening an image to transform it into the requested output `format`. + +By default, Sharp uses a black background when flattening an image. Specifying a different background color is especially useful when transforming images with transparent backgrounds to a format that does not support transparency (e.g. `jpeg`): + +```astro title="src/components/MyComponent.astro" "background" +--- +import { Image } from 'astro:assets'; +import myImage from '../assets/my_image.png'; +--- +A description of my image +``` + +Values are passed directly to the image service. Sharp accepts [any value the `color-string` package can parse](https://github.com/Qix-/color-string/blob/master/README.md#parsing). + ### ``