Interface ColorProvider

Abstraction of a Gradient or Texture.

interface ColorProvider {
    decrementUse<T>(viewDOM: ViewDOM<T>, defs: T): void;
    incrementUse<T>(viewDOM: ViewDOM<T>, defs: T): void;
    serialize(): string;
}

Methods

  • Indicates to the ColorProvider that it is being used in one less fill or stroke property. The ColorProvider is expected to remove itself from the SVG defs element when no longer used.

    Type Parameters

    • T

    Parameters

    Returns void

  • Indicates to the ColorProvider that it is being used in one more fill or stroke property. The ColorProvider is expected to add itself to the SVG defs element when being used.

    Type Parameters

    • T

    Parameters

    Returns void

  • Provide the value that will be used in the fill or stroke attribute of the consuming element. Usually url(#${this.id}) for gradients and textures but may be e.g. an rgb() or #RRGGBB value.

    Returns string