1.0.5 • Published 6 months ago
@types/color-hash v1.0.5
Installation
npm install --save @types/color-hash
Summary
This package contains type definitions for color-hash (https://github.com/zenozeng/color-hash).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/color-hash.
index.d.ts
// Type definitions for color-hash 1.0
// Project: https://github.com/zenozeng/color-hash
// Definitions by: Johannes Hoppe <https://github.com/JohannesHoppe>
// Kamil Socha <https://github.com/ksocha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type ColorValueArray = [number, number, number];
interface HueObject {
min: number;
max: number;
}
type Hue = number | HueObject | ReadonlyArray<HueObject>;
type Lightness = number | number[];
type Saturation = number | number[];
type HashFunction = (input: string) => number;
interface ColorHashOptions {
lightness?: Lightness | undefined;
saturation?: Saturation | undefined;
hue?: Hue | undefined;
hash?: HashFunction | undefined;
}
declare class ColorHash {
constructor(options?: ColorHashOptions);
/**
* Returns the hash in [h, s, l].
* Note that H ∈ [0, 360); S ∈ [0, 1]; L ∈ [0, 1];
*
* @param input string to hash
* @returns [h, s, l]
*/
hsl(input: string): ColorValueArray;
/**
* Returns the hash in [r, g, b].
* Note that R, G, B ∈ [0, 255]
*
* @param input string to hash
* @returns [r, g, b]
*/
rgb(input: string): ColorValueArray;
/**
* Returns the hash in hex.
*
* @param input string to hash
* @returns hex with #
*/
hex(input: string): string;
}
export as namespace ColorHash;
export = ColorHash;
Additional Details
- Last updated: Sun, 28 Nov 2021 23:31:06 GMT
- Dependencies: none
- Global values:
ColorHash
Credits
These definitions were written by Johannes Hoppe, and Kamil Socha.