This is the documentation of version 0.63.0. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Variable deriveMapColorsFromCssConst

    deriveMapColorsFromCss: (
        cssText: string,
        options?: MapThemeExtractionOptions,
    ) => Required<MapColors>

    Derives the map colours from a stylesheet — a site's CSS, a design system's tokens — by reading the colours it paints with (cssColors) and assigning them roles with deriveMapColors.

    With mode: 'auto', the default, the map is light or dark as the page is: its background on :root, html or body, or else the grey most rules fill with, and light when neither resolves. Needs no DOM.

    Type Declaration

    RangeError when the stylesheet paints with no opaque colour.

    // A File from an <input type="file" accept=".css">, or CSS a server fetched
    styling.setMapColors(deriveMapColorsFromCss(await fileInput.files[0].text()));