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 streetLight clamps to black. It 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' ? 'streetDark' : 'streetLight');
    styling.setMapColors(colors);