This is the documentation of version 1.0.0-rc.4. Go to the latest version, 1.0.0-rc.5.
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

    Public Preview until the plugin's 1.0.0 release.

    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' }));