-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.d.ts
39 lines (35 loc) · 993 Bytes
/
main.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
39
import type { Stream } from 'node:stream'
import type { ChalkInstance } from 'chalk'
export type Options = Partial<
Readonly<{
/**
* Whether colors should be enabled/disabled, regardless of terminal
* support.
* Colors support is automatically detected, so this is only meant to
* override that default behavior.
*
* @default undefined
*/
colors: boolean | undefined
/**
* Stream used to detect colors support.
* This should be the file or terminal where the colors are output.
*
* @default process.stdout
*/
stream: Stream
}>
>
/**
* Return a [`chalk`](https://github.com/chalk/chalk) instance that is enabled
* or not based on colors support.
*
* @example
* ```js
* const exampleLibrary = ({ colors, ...otherLibraryOptions }) => {
* const chalk = colorsOption({ colors })
* console.log(chalk.red('example'))
* }
* ```
*/
export default function colorsOption(options?: Options): ChalkInstance