# @types/color-hash

> TypeScript definitions for color-hash

Latest version **2.0.0** (published 2024-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/color-hash
pnpm add @types/color-hash
yarn add @types/color-hash
bun add @types/color-hash
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2024-05-31 |
| First published | 2020-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51436 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/color-hash
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/color-hash
- npm.io page: https://npm.io/package/@types/color-hash

## Recent versions

- 2.0.0 (latest) — 2024-05-31
- 1.0.5 (ts4.6) — 2023-11-20
- 1.0.2 (ts3.9) — 2021-11-28
- 1.0.1 (ts3.7) — 2021-07-08
- 1.0.0 (ts3.3) — 2020-01-13
- 1.0.4 — 2023-11-07
- 1.0.3 — 2023-10-18

## README

# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/color-hash/index.d.ts)
````ts
declare namespace ColorHash {
    type ColorValueArray = [number, number, number];

    interface HueObject {
        min: number;
        max: number;
    }

    type Hue = number | HueObject | readonly HueObject[];
    type Lightness = number | number[];
    type Saturation = number | number[];

    type HashFunction = (input: string) => number;

    interface ColorHashOptions {
        lightness?: Lightness;
        saturation?: Saturation;
        hue?: Hue;
        hash?: HashFunction | "bkdr";
    }
}

declare class ColorHash {
    constructor(options?: ColorHash.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): ColorHash.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): ColorHash.ColorValueArray;

    /**
     * Returns the hash in hex.
     *
     * @param input string to hash
     * @returns hex with #
     */
    hex(input: string): string;
}

export = ColorHash;

````

### Additional Details
 * Last updated: Fri, 31 May 2024 10:07:25 GMT
 * Dependencies: none

# Credits
These definitions were written by [Johannes Hoppe](https://github.com/JohannesHoppe), and [Kamil Socha](https://github.com/ksocha).

---
_Source: https://npm.io/package/@types/color-hash · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
