Skip to content

Image Palette

Pro

Get the main colors of a photo and pick one, such as an accent for a cover. It shows a loading, error, and empty state.

  • Base UI
  • React Aria
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · Pro license

Playground

Loading the preview

Props

Needs your Pro API key in GELATIN_UI_PRO_TOKEN. Set it up

Pro itemAPI key required

Image Palette needs a Pro API key

Try the live preview for free. With Pro, the add command above puts the source in your project.

Files it adds
39
More Pro items, one API key
+327
Your coding agent runs it
1 cmd

$79$129once, for life

Already have Pro? Sign in to set up your API key.

Compose the picture, the swatches, and the strip in your own layout. Add the error and empty parts, so each state has words.

photo-colors.tsx

ImagePalette

<div>
PropTypeDefaultDescription
srcstring—The picture to read. Its site must send a CORS header, else the error part shows.
altRequiredstring—What the picture shows: the name of the image and of the palette.
countnumber5How many colors to find, 2 to 8. Default 5.
mode"accent""share""share"share (default): the colors the picture is made of, the largest area first. accent: the colors that stand out (chroma by share), for a brand or an accent color.
valuestring | Color—The picked color (controlled).
defaultValuestring | Color—The picked color at first (uncontrolled). Default: none.
onValueChange—Runs when people pick a color, with the Color and the change details.
onPaletteReady—Runs when the colors of a new picture are ready (once per src).
labels—The words (IMAGE_PALETTE_LABELS), to translate them. Keep the object stable.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImagePaletteImage

<div>
PropTypeDefaultDescription
srcSetstring—A ready srcset for src ("a-640.jpg 640w, a-1280.jpg 1280w"), with sizes: for files that a server already made at each width. It wins over loader and transformer. Change it together with src: the old picture keeps only its src while the new one loads.
widthnumber—The width of the box in px. With height, it sets the box ratio before the file loads.
heightnumber—
fillboolean—Fill the positioned parent (absolute inset-0). Give the parent a size.
sizesstring—The sizes of the srcset: how wide the box is per screen ("(max-width: 640px) 100vw, 33vw").
loaderImageLoader—Makes the URL of each srcset width, Next.js style. Default: the loader of the nearest ImageLoaderProvider (none outside one).
transformerImageTransformer—An Unpic provider transformer, an alternative to loader.
qualitynumber—The quality that loader and transformer get (1–100).
preloadboolean—A picture above the fold (a hero): loads at once with a high fetch priority, and React preloads it (<link rel="preload"> with the srcset). Default false: lazy.
placeholder—What shows while the file loads: muted (default, the muted box), skeleton (the box with a shimmer band), blur (blurDataURL, blurred), color (placeholderColor), none (no fill, also on an error: the parent shows), or an element: your own layer under the file until its fade ends (a sharp thumbnail of the same picture).
blurDataURLstring—A tiny copy of the picture (10px or less, a data URL) for placeholder="blur".
placeholderColorstring—The main color of the picture for placeholder="color" (a data color).
positionstring—The CSS object-position of the picture in the box ("top", "30% 60%").
fadeboolean—Fade the file in when it loads. Default true. A file the page already loaded, or a server file, shows at once.
onLoadingStatusChange—Called with the new status: idle, loading, loaded, error.
onLoad—
onError—
classNamestring—The classes of the box (size, corners, ratio).
imgClassNamestring—The classes of the <img>.
styleCSSProperties—
childrenReactNode—An ImageFallback for the error and the no-src box. Default: an icon (none for alt=""). With a child, the root is not role="img": the fallback speaks for itself, and an img role would hide its words and controls (a retry button) from screen readers.
fit"contain""cover"—
rounded"default""full"—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImagePaletteSwatches

PropTypeDefaultDescription
aria-labelstring—Defines a string value that labels the current element.
aria-labelledbystring—Identifies the element (or elements) that labels the current element.
aria-describedbystring—Identifies the element (or elements) that describes the object.
aria-detailsstring—Identifies the element (or elements) that provide a detailed, extended description for the object.
dirstring—
langstring—
hiddenboolean—
inertboolean—
translate"no""yes"—
suppressHydrationWarningboolean—A React-only flag that suppresses the warning React normally logs when an element's server-rendered content doesn't match the client render during hydration. See React docs.
onClickMouseEventHandler<HTMLDivElement>—
onClickCaptureMouseEventHandler<HTMLDivElement>—
onAuxClickMouseEventHandler<HTMLDivElement>—
onAuxClickCaptureMouseEventHandler<HTMLDivElement>—
onContextMenuMouseEventHandler<HTMLDivElement>—
onContextMenuCaptureMouseEventHandler<HTMLDivElement>—
onDoubleClickMouseEventHandler<HTMLDivElement>—
onDoubleClickCaptureMouseEventHandler<HTMLDivElement>—
onMouseDownMouseEventHandler<HTMLDivElement>—
onMouseDownCaptureMouseEventHandler<HTMLDivElement>—
onMouseEnterMouseEventHandler<HTMLDivElement>—
onMouseLeaveMouseEventHandler<HTMLDivElement>—
onMouseMoveMouseEventHandler<HTMLDivElement>—
onMouseMoveCaptureMouseEventHandler<HTMLDivElement>—
onMouseOutMouseEventHandler<HTMLDivElement>—
onMouseOutCaptureMouseEventHandler<HTMLDivElement>—
onMouseOverMouseEventHandler<HTMLDivElement>—
onMouseOverCaptureMouseEventHandler<HTMLDivElement>—
onMouseUpMouseEventHandler<HTMLDivElement>—
onMouseUpCaptureMouseEventHandler<HTMLDivElement>—
onTouchCancelTouchEventHandler<HTMLDivElement>—
onTouchCancelCaptureTouchEventHandler<HTMLDivElement>—
onTouchEndTouchEventHandler<HTMLDivElement>—
onTouchEndCaptureTouchEventHandler<HTMLDivElement>—
onTouchMoveTouchEventHandler<HTMLDivElement>—
onTouchMoveCaptureTouchEventHandler<HTMLDivElement>—
onTouchStartTouchEventHandler<HTMLDivElement>—
onTouchStartCaptureTouchEventHandler<HTMLDivElement>—
onPointerDownPointerEventHandler<HTMLDivElement>—
onPointerDownCapturePointerEventHandler<HTMLDivElement>—
onPointerMovePointerEventHandler<HTMLDivElement>—
onPointerMoveCapturePointerEventHandler<HTMLDivElement>—
onPointerUpPointerEventHandler<HTMLDivElement>—
onPointerUpCapturePointerEventHandler<HTMLDivElement>—
onPointerCancelPointerEventHandler<HTMLDivElement>—
onPointerCancelCapturePointerEventHandler<HTMLDivElement>—
onPointerEnterPointerEventHandler<HTMLDivElement>—
onPointerLeavePointerEventHandler<HTMLDivElement>—
onPointerOverPointerEventHandler<HTMLDivElement>—
onPointerOverCapturePointerEventHandler<HTMLDivElement>—
onPointerOutPointerEventHandler<HTMLDivElement>—
onPointerOutCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCapturePointerEventHandler<HTMLDivElement>—
onGotPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCapturePointerEventHandler<HTMLDivElement>—
onLostPointerCaptureCapturePointerEventHandler<HTMLDivElement>—
onScrollUIEventHandler<HTMLDivElement>—
onScrollCaptureUIEventHandler<HTMLDivElement>—
onWheelWheelEventHandler<HTMLDivElement>—
onWheelCaptureWheelEventHandler<HTMLDivElement>—
onAnimationStartAnimationEventHandler<HTMLDivElement>—
onAnimationStartCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationEndAnimationEventHandler<HTMLDivElement>—
onAnimationEndCaptureAnimationEventHandler<HTMLDivElement>—
onAnimationIterationAnimationEventHandler<HTMLDivElement>—
onAnimationIterationCaptureAnimationEventHandler<HTMLDivElement>—
onTransitionCancelTransitionEventHandler<HTMLDivElement>—
onTransitionCancelCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionEndTransitionEventHandler<HTMLDivElement>—
onTransitionEndCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionRunTransitionEventHandler<HTMLDivElement>—
onTransitionRunCaptureTransitionEventHandler<HTMLDivElement>—
onTransitionStartTransitionEventHandler<HTMLDivElement>—
onTransitionStartCaptureTransitionEventHandler<HTMLDivElement>—
style—The inline style for the element. A function may be provided to compute the style based on component state.
render—Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: - You must render the expected element type (e.g. if <button> is expected, you cannot render an <a>). - Only a single root DOM element can be rendered (no fragments). - You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
layout"grid""stack"'grid'Whether the items are arranged in a stack or grid.
classNamestring—
rounded"default""full"—The corner of every swatch and its ring: default (4, 6, 8px) or full (a circle).

ImagePaletteStrip

<div>
PropTypeDefaultDescription
orientation"horizontal""vertical"—horizontal (default) fills the width; vertical stacks the parts.
gapboolean—2px gaps between the parts; each part keeps 2px corners and its own edge.
labelsPartial<{ empty: string; }>—The words (PALETTE_STRIP_LABELS), to translate them. Keep the object stable.
size"default""lg""sm""sm"
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImagePaletteError

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImagePaletteEmpty

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it when a color must fit a picture.
  • Use mode="accent" for the colors that stand out, not the largest areas.
  • Use onPaletteReady to get all the colors of a new picture.
TabMoves focus to the selected swatch.
Arrow keysMoves to the next color and picks it.
Ready
indicator · 200ms · the swatches fade in together

Built with

Installs with Image Palette

  1. AddedImage Palette, with Palette Strip, Color Swatch Picker, Empty, Image, Skeleton.
Open the release