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 mapColorsLightDarkConst

    mapColorsLightDark: (
        { land, label }: Pick<Required<MapColors>, "land" | "label">,
    ) => LightDark

    Whether map colours make a light or a dark map (dark when labels are lighter than land), to apply them over a style of the same: StylingFoundationsModule.setMapColors keeps the loaded style's shade offsets, which a dark land over standardLight clamps to black. Tells what auto chose.

    Type Declaration

      • ({ land, label }: Pick<Required<MapColors>, "land" | "label">): LightDark
      • Parameters

        • { land, label }: Pick<Required<MapColors>, "land" | "label">

        Returns LightDark

    const colors = await deriveMapColorsFromImage(file);
    const lightDark = mapColorsLightDark(colors);
    if (lightDark !== map.styleLightDarkTheme) await map.setStyle(lightDark === 'dark' ? 'standardDark' : 'standardLight');
    styling.setMapColors(colors);