TomTom Maps for JavaScript
    Preparing search index...

    Variable deriveMapColorsFromImageConst

    deriveMapColorsFromImage: (
        source: MapThemeImageSource,
        options?: MapThemeExtractionOptions,
    ) => Promise<Required<MapColors>>

    Derives the map colours from an image (a photo, a logo, a poster) by extracting its dominant colours and assigning them roles with deriveMapColors.

    Type Declaration

    RangeError when the image has no opaque pixels, or an error when it cannot be read (not CORS-readable, no DOM to decode it).

    // A File from an <input type="file">, a Blob, an <img>, an ImageBitmap or a CORS-readable URL
    styling.setMapColors(await deriveMapColorsFromImage(fileInput.files[0], { mode: 'dark' }));