Color scale preset file schema.
The interpolation hint used when accessing a color using interpolation, e.g., @seelerp.
The interpolation hint used when accessing a color using interpolation, e.g., @seelerp.
Whether or not the scale was inverted based on its initial state.
Provides read access to the number of colors of this scale. This is a shortcut for this.colors.length.
Converts the color scale into an array of interleaved float values of the requested color space.
Color space that is to be used for the array.
Whether or not alpha is to be included.
Converts the color scale into an array of interleaved unsigned int values of the requested color space.
Color space that is to be used for the array.
Whether or not alpha is to be included.
Inverts the color scale. Whether or not the scale is inverted can be checked using the inverted read-only property (@link inverted).
Queries the color at a given position by identifying the adjacent stops (lower and upper bound) and either interpolating between these or picking the nearest of both. In case no stop exists, a default color will be returned. If only one color exists, this color is always returned no matter the position. If the position is out of bounds, either the first or last stop's color is returned.
Position in [0.0, 1.0] to linear interpolate the color at.
The color space that is to be used for linear interpolation of two colors.
Creates a color scale from a set of colors and (optional) positions for a specific step count. If no positions are specified, the colors are spread equally. A step count of 1 returns the first color.
Interleaved array of color components, e.g., red, green, and blue.
The array type specifying the number of subsequent color components for each color.
Number of colors to be computed from the color scale.
Interleaved array of positions, matching the length of the color array divided by stride.
Fetches a color schema file, and, if successful, picks a preset for the specified number of steps. If the named preset cannot be found, a list of all available presets within the file is logged and undefined is returned. If the preset does not specify exact colors for the requested number of steps, the color array with the most colors and linear interpolation in CIE-LAB is used to generate the scale.
The following preset libraries are included within webgl-operate but are required to be loaded dynamically (in order to reduce bundle size and memory use):
ColorScale.fromPreset('./colorbrewer.json', 'YlGnBu', 7);
ColorScale.fromPreset('./smithwalt.json', 'viridis', 16);
And resolving the promise:
const scale: ColorScale | undefined = undefined;
ColorScale.fromPreset('./data/colorbrewer.json', 'YlGnBu', 5).then((value) => scale = value);
Uniform resource locator string referencing a json file complying to the JSON color schema.
Name of a preset to choose from the json file.
Number of steps to be used for the resulting color scheme.
Returns the stride for interleaved arrays of color components based on the array type.
One of the supported color array types.
colors}