projects / calore

calculate and cache album art color palettes from spotify, musicbrainz, and iTunes

calore is a REST API running on a cloudflare worker that calculates and caches cover art for albums on musicbrainz, spotify, and iTunes.

it support returning a variable amount of colors as well as saving stored colors for performance.

calore powers this website’s color themes!

usage

in essence:

https://calore.twofortyeight.net?image=IMAGE_URL&count=COLOR_COUNT
  • image should be a spotify album art/CAA url from i.scdn.co or coverartarchive.org/release/.

  • color (optional) should be the number of desired colors, 1-10. defaults to 4. if you want a dominant color, i recommend using the default (4) and just taking the first color.

the response exists in this format, where each color is in RGB:

{
    palette: [
        [
            number,
            number,
            number
        ],
        ...
    ]
}

the cache keys use the following structure:

{color count}:{image slug}

example:

// xhs "https://calore.twofortyeight.net/?image=https://i.scdn.co/image/ab67616d0000b273f8c7a1c275f8c00dd0b4eb6f"
{
    "palette": [
        [
            200,
            195,
            192
        ],
        [
            67,
            58,
            59
        ],
        [
            93,
            91,
            98
        ],
        [
            114,
            94,
            102
        ]
    ]
}

demo

this is the album that generated the current website theme:

"Working Title For The Album Secret Waters" cover art

the code and full README are located here (thrzl/calore).

~about ~projects ~contact ~planet
~ this page emitted a little under 0.007 gCO2e ~