Skip to content

GraphQL

Overview

The Image Colors field exposes a rich ImageColors GraphQL type, giving you full query support for all regions and color data -- perfect for building dynamic, color-aware front ends!

Query Example

graphql
{
  assets {
    colorData {
      overall { hex rgb weight percentage }
      focal { hex rgb weight percentage }
      top { hex rgb weight percentage }
      right { hex rgb weight percentage }
      bottom { hex rgb weight percentage }
      left { hex rgb weight percentage }
      focalPoint { x y }
    }
  }
}

Each region returns its own palette, so you can target exactly the part of the image that matters most to your design.

Types

ImageColors

Top-level type returned by the field.

FieldTypeDescription
overall[ImageColorsPaletteEntry]Colors for the full image
focal[ImageColorsPaletteEntry]Colors from the focal region
top[ImageColorsPaletteEntry]Colors from the top strip
right[ImageColorsPaletteEntry]Colors from the right strip
bottom[ImageColorsPaletteEntry]Colors from the bottom strip
left[ImageColorsPaletteEntry]Colors from the left strip
focalPointImageColorsFocalPointThe asset's focal point coordinates

ImageColorsPaletteEntry

FieldTypeDescription
hexStringHex color value (e.g. #C7BA21)
rgb[Int]RGB array [r, g, b]
weightFloatProportion of pixels in the region (0--1)
percentageFloatWeight as a rounded percentage

ImageColorsFocalPoint

FieldTypeDescription
xFloatHorizontal focal point (0--1)
yFloatVertical focal point (0--1)