Color Palette Extraction palette

The palette parameter extracts a palette of color values from an image and returns them in the specified format. Palette extraction occurs after image processing, so applying any adjustments and cropping effects will change the color palette response. Valid values are css and json.

This parameter generally outputs two palette sets—both choose colors based on their dominance in the image. The default set is strictly algorithmic, based on frequency of the color in the image, and is always available. The "dominance" set also weights frequency, but selects the colors to provide a more coordinated palette across the image's colorspace and names the colors by their relative values, like Vibrant.js does.

The default palette set defaults to six colors, but can be overridden with the colors parameter. The dominance palette set provides up to six named colors:

  • Vibrant
  • Vibrant Dark
  • Vibrant Light
  • Muted
  • Muted Dark
  • Muted Light

The dominance palette will vary (and may not be generated) depending on whether the image's colors meet the criteria for each name. It may return all six colors, a portion, or none, although most images will return a complete set.


The response to the image request will be a CSS file with the text/css MIME type. Class pairs have a "foreground" and a "background" defintion. The foreground class has a color property defined, while the background class has a background-color property defined. The CSS output also includes white and black, to make displaying a colorPalette-swatch set easier.

If prefix is also set, its value will replace "image" in the CSS class names in the output CSS file.

.image-fg-1 { color:#ffd807 !important; }
.image-bg-1 { background-color:#ffd807 !important; }
.image-fg-2 { color:#6dca9a !important; }
.image-bg-2 { background-color:#6dca9a !important; }
.image-fg-3 { color:#04a450 !important; }
.image-bg-3 { background-color:#04a450 !important; }
.image-fg-4 { color:#971d01 !important; }
.image-bg-4 { background-color:#971d01 !important; }
.image-fg-5 { color:#566363 !important; }
.image-bg-5 { background-color:#566363 !important; }
.image-fg-6 { color:#463a49 !important; }
.image-bg-6 { background-color:#463a49 !important; }
.image-fg-ex-1 { color:#ffffff !important; }
.image-bg-ex-1 { background-color:#ffffff !important; }
.image-fg-ex-2 { color:#000000 !important; }
.image-bg-ex-2 { background-color:#000000 !important; }
.image-fg-vibrant { color:#ffd807 !important; }
.image-bg-vibrant { background-color:#ffd807 !important; }
.image-fg-muted-dark { color:#2b5557 !important; }
.image-bg-muted-dark { background-color:#2b5557 !important; }
.image-fg-muted { color:#589964 !important; }
.image-bg-muted { background-color:#589964 !important; }
.image-fg-vibrant-light { color:#a3e0da !important; }
.image-bg-vibrant-light { background-color:#a3e0da !important; }
.image-fg-muted-light { color:#d2cfb7 !important; }
.image-bg-muted-light { background-color:#d2cfb7 !important; }
.image-fg-vibrant-dark { color:#018f53 !important; }
.image-bg-vibrant-dark { background-color:#018f53 !important; }

Here's how this works in practice:

<link rel="stylesheet" href="">

A very colorful little frog

Original Palette

Dominance Palette

As mentioned above, the palette calculations are done after all other resizing and enhancement operations. Here 's the same image with a sepia filter applied, and with the palettes limited to six colors:

<link rel="stylesheet" href="">

A more subdued, sepia-tone frog

Original Palette

Dominance Palette


The response will be a JSON object with the application/json MIME type. The JSON object has three top-level properties: a floating-point average_luminance value, a colors array of colors for the original palette, and a dominant_colors array that represents the Vibrant.js-style values.

Each color in the colors and dominant_colors arrays contains a hash describing its red, green, and blue components (expressed as floating point numbers between 0.0 and 1.0), and a hex value.

If palette is set to json, the prefix parameter is ignored.

Here is the JSON payload from the tree frog image used above:


Please note:
Using colorquant will not affect the results of the palette parameter. The colorquant parameter limits the number of colors that display based off the base image; however, these colors still exist within the image data itself.

See the API specification for more information about this parameter's value ranges and format.