Skip to content

extractColorPreset

Spicetify.extractColorPreset runs Spotify’s color extraction on an image and returns the colors Spotify’s UI would use for it. It accepts a Spotify image URI or an image URL, or a list of them, and resolves one preset per image.

function extractColorPreset(image: string | string[]): Promise<
{
colorRaw: Color;
colorLight: Color;
colorDark: Color;
isFallback: boolean;
}[]
>;
ParameterTypeDescription
imagestring | string[]A Spotify image URI or an image URL, or a list of them.

Each color is a Color. isFallback is true when Spotify couldn’t extract colors and returned its default ones.

const [preset] = await Spicetify.extractColorPreset(imageUrl);
if (!preset.isFallback) {
header.style.background = preset.colorDark.toCSS(Spicetify.Color.CSSFormat.HEX);
}

For the color extractor service that works from an item URI, see colorExtractor.