basemapkit
Version:
<p align="center"> <img src="./public/logo.svg" alt="Basemapkit logo" width="400px"></img> </p> <p align="center"> Basemaps for <a href="https://maplibre.org/maplibre-gl-js/docs/">Maplibre GL JS</a> + <a href="https://protomaps.com/">Protomaps</a> </p>
139 lines (138 loc) • 4.13 kB
TypeScript
import { StyleSpecification } from 'maplibre-gl';
/**
* Options to modify colors of a base style
*/
export type ColorEdit = {
/**
* Invert the image color
*/
negate?: boolean;
/**
* Ratio relative to current brightness.
* Value in [-1, 1] but the range is actually open
*/
brightness?: number;
/**
* Absolute brightness shift
* Value in [-1, 1] but the range is actually open
*/
brightnessShift?: number;
/**
* Exposure, like brightness but more preserving
* Value in [-1, 1] but the range is actually open
*/
exposure?: number;
/**
* Rotate the hue wheel
* Value in [-180, 180] but the range is actually open
*/
hueRotation?: number;
/**
* Modifiy color saturation
* Value in [-1, 1] but the range is actually open
*/
saturation?: number;
/**
* Multiply every color with the given one.
*/
multiplyColor?: [
/**
* CSS color
*/
string,
/**
* Mixing ratio in [0, 1], where 0 is fully the original color and 1 is fully the provided one.
*/
number
];
/**
* Mix every color with the given one.
*/
mixColor?: [
/**
* CSS color
*/
string,
/**
* Mixing ratio in [0, 1], where 0 is fully the original color and 1 is fully the one provided.
*/
number
];
/**
* Apply contrast, providing a contrast intensity and a mid (inflection) point
*/
contrast?: [
/**
* Contrast intensity. Value in [-1, 1] but is actually an open range
*/
number,
/**
* Color intensity mid point in the range [0, 255]
*/
number
];
};
export type Lang = "ar" | "cs" | "bg" | "da" | "de" | "el" | "en" | "es" | "et" | "fa" | "fi" | "fr" | "ga" | "he" | "hi" | "hr" | "hu" | "id" | "it" | "ja" | "ko" | "lt" | "lv" | "ne" | "nl" | "no" | "mr" | "mt" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "tr" | "uk" | "ur" | "vi" | "zh-Hans" | "zh-Hant";
export type GetStyleOptions = {
/**
* The public URL of a pmtiles files. To use if sourcing tiles directly with
* range-request using the `pmtiles`'s protocol. Alternatively, the option `tileJson` can be used and will take precedence.
*/
pmtiles?: string;
/**
* The public URL to a tile JSON file. To use if classic z/x/y MVT tiles are served through
* Maplibre's Martin or the pmtiles CLI. Will take precedence on the option `pmtiles` if both are provided.
*/
tilejson?: string;
/**
* URL of the sprites
*/
sprite?: string;
/**
* URL of the glyphs
*/
glyphs: string;
/**
* Language to apply to the basemap. Leaving this undefined will set to auto mode and use the platform language of the end user.
*/
lang?: Lang;
/**
* Language script to apply to the basemap
*/
script?: string;
/**
* Points Of Interests are shown by default, requiring a sprite URL. Passing this option as `true` will remove the POIs layer
* and make the `sprite` option unnecessary.
*/
hidePOIs?: boolean;
/**
* Labels are shown by default, requiring a glyphs URL. Passing this options as `true` will remove the label layers and make the
* `glyphs` option unnecessary.
*/
hideLabels?: boolean;
};
/**
* Options relative to building a style
*/
export type BuildStyleOptions = GetStyleOptions & {
/**
* Name of the style to start from
*/
baseStyleName: string;
/**
* Optional color modification to apply to the provided style
*/
colorEdit?: ColorEdit;
};
/**
* Returns the list of styles available.
*/
export declare function getStyleList(): string[];
/**
* Get a style.
*/
export declare function getStyle(styleName: string, options: GetStyleOptions): StyleSpecification;
/**
* Build your own style, using one of the base style as starting point.
*/
export declare function buildStyle(options: BuildStyleOptions): StyleSpecification;