-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
38 lines (38 loc) · 1.1 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
declare module "generate-colors" {
export type GenerateColorOptions = {
/**
* Brightness/value of hue
* https://en.wikipedia.org/wiki/Brightness
*/
brightness?: number | ((defaultBrightness: number) => number)
/**
* Saturation
* https://en.wikipedia.org/wiki/Colorfulness
*/
saturation?: number | ((defaultSaturation: number) => number)
/**
* This is the value of brightness of hue
* https://en.wikipedia.org/wiki/Brightness
* @deprecated Please use brightness
*/
contrast?: number
}
/**
* Get a color [r,g,b] for a given string
* HSV is used for saturation and value/brightness
* https://en.wikipedia.org/wiki/HSL_and_HSV
*/
export function getColorForString(
str: string,
options?: GenerateColorOptions
): [red: number, green: number, blue: number]
/**
* Create a cached version of getColorForString
*/
export function makeGetColorForOptions(
/**
* Options applied to each further invocations
*/
options?: GenerateColorOptions
): (str: string) => [red: number, green: number, blue: number]
}