Module: ol/colorlike

ol/colorlike


import * as olColorlike from 'ol/colorlike';

Functions

asColorLike(color){ColorLike | null}

import {asColorLike} from 'ol/colorlike';
Name Type Description
color Color | ColorLike | PatternDescriptor | null

Color.

Returns:
The color as an ol/colorlike~ColorLike.

Type Definitions

ColorLike{string} {CanvasPattern} {CanvasGradient}

A type accepted by CanvasRenderingContext2D.fillStyle or CanvasRenderingContext2D.strokeStyle. Represents a color, CanvasPattern, or CanvasGradient. The origin for patterns and gradients as fill style is an increment of 512 css pixels from map coordinate [0, 0]. For seamless repeat patterns, width and height of the pattern image must be a factor of two (2, 4, 8, ..., 512).

PatternDescriptor{Object}

Properties:
Name Type Description
src string

Pattern image URL

color Color | string | undefined

Color to tint the pattern with.

size Size | undefined

Size of the desired slice from the pattern image. Use this together with offset when the pattern image is a sprite sheet.

offset Size | undefined

Offset of the desired slice from the pattern image. Use this together with size when the pattern image is a sprite sheet.