1.2.9 • Published 2 years ago

@types/geopattern v1.2.9

Weekly downloads
667
License
MIT
Repository
github
Last release
2 years ago

Installation

npm install --save @types/geopattern

Summary

This package contains type definitions for GeoPattern (https://github.com/btmills/geopattern).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/geopattern.

index.d.ts

// Type definitions for GeoPattern 1.2
// Project: https://github.com/btmills/geopattern, http://btmills.github.io/geopattern/geopattern.html
// Definitions by: Gaelan <https://github.com/Gaelan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

/// <references types="jquery" />

export as namespace GeoPattern;

/**
 * Returns a newly-generated, tiling SVG Pattern.
 *
 * @param string Will be hashed using the SHA1 algorithm, and the resulting hash
 * will be used as the seed for generation.
 */
export function generate(string?: string, options?: PatternOptions): Pattern;

export interface PatternOptions {
    /**
     * Specify an exact background color. This is a CSS hexadecimal color
     * value.
     */
    color?: string | undefined;

    /**
     * Controls the relative background color of the generated image. The color
     * is not identical to that used in the pattern because the hue is rotated
     * by the generator. This is a CSS hexadecimal color value, which defaults
     * to #933c3c.
     */
    baseColor?: string | undefined;

    /**
     * Determines the pattern. All of the original patterns from the Ruby
     * version at jasonlong/geo_pattern are available in this port, and their
     * names are camelCased.
     */
    generator?: GeneratorType | undefined;
}

export type GeneratorType = 'chevrons' | 'octogons' | 'overlappingCircles' |
    'plusSigns' | 'xes' | 'sineWaves' | 'hexagons' | 'overlappingRings' |
    'plaid' |'triangles' | 'squares' | 'nestedSquares' | 'mosaicSquares' |
    'concentricCircles' | 'diamonds' | 'tessellation';

export interface Pattern {
    /** Gets the pattern's background color as a hexadecimal string. */
    color: string;

    /** Gets the SVG string representing the pattern. */
    toString(): string;

    /** Gets the SVG string representing the pattern. */
    toSvg(): string;

    /** Gets the SVG as a Base64-encoded string. */
    toBase64(): string;

    /**
     * Gets the pattern as a data URI,
     * i.e. data:image/svg+xml;base64,PHN2ZyB...
     */
    toDataUri(): string;

    /**
     * Gets the pattern as a data URL suitable for use as a CSS
     * background-image, i.e. url("data:image/svg+xml;base64,PHN2ZyB...").
     */
    toDataUrl(): string;
}

declare global {
    interface JQuery {
        geopattern(string: string, options?: PatternOptions): JQuery;
    }
}

Additional Details

  • Last updated: Wed, 24 Nov 2021 21:31:10 GMT
  • Dependencies: none
  • Global values: GeoPattern

Credits

These definitions were written by Gaelan.

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

5 years ago

1.2.3

6 years ago

1.2.2

8 years ago

1.2.1

9 years ago

1.2.0

9 years ago