# roundel/supports-color

> Every export of roundel/supports-color, with its signature and doc comment: createSupportsColor, supportsColor, plus 4 types.

Source: https://roundel.interlace.tools/docs/api/supports-color

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

```ts
import supportsColor from 'roundel/supports-color';
import { createSupportsColor } from 'roundel/supports-color';
```

## Functions

### createSupportsColor

The colour support of `stream`, or of no stream in particular when it is left out.

```ts
function createSupportsColor(stream?: Pick<WriteStream, 'isTTY'>, options?: Options): ColorInfo;
```

| Parameter | Type |
| :-- | :-- |
| `stream` (optional) | `Pick<WriteStream, 'isTTY'>` |
| `options` (optional) | `Options` |

**Returns** `ColorInfo`

## Constants

### default

The default export, declared as `supportsColor`.

supports-color's module: stdout's and stderr's support, decided at import.

```ts
const supportsColor: {
    stdout: ColorInfo;
    stderr: ColorInfo;
};
```

## Interfaces

### ColorSupport

A level and what it implies.

```ts
interface ColorSupport {
    level: ColorSupportLevel;
    hasBasic: boolean;
    has256: boolean;
    has16m: boolean;
}
```

### Options

```ts
interface Options {
    /** Whether `process.argv` is sniffed for `--color` and `--no-color` flags. Default `true`. */
    readonly sniffFlags?: boolean;
    /** The stream's TTY-ness, when it is not the stream's own `isTTY`. */
    readonly streamIsTTY?: boolean | undefined;
}
```

## Types

### ColorInfo

`false` when the stream gets no colour.

```ts
type ColorInfo = ColorSupport | false;
```

### ColorSupportLevel

`0` no colour, `1` the basic 16, `2` ANSI 256, `3` truecolor.

```ts
type ColorSupportLevel = 0 | 1 | 2 | 3;
```
