TomTom Maps for JavaScript
    Preparing search index...

    Variable deriveMapColorsFromCssConst

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

    Derives the map colours from a stylesheet, such as a site's CSS or a design system's tokens. It reads its colours with cssColors and assigns them roles with deriveMapColors.

    With mode: 'auto', the default, the map follows the page's lightness, read off its background on :root, html or body, or else the grey most rules fill with, and is light when neither resolves. It 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()));