https://github.com/fabiospampinato/tiny-colors
A tiny library providing the basic ANSI colors for the terminal.
https://github.com/fabiospampinato/tiny-colors
cli colors terminal tiny
Last synced: 12 months ago
JSON representation
A tiny library providing the basic ANSI colors for the terminal.
- Host: GitHub
- URL: https://github.com/fabiospampinato/tiny-colors
- Owner: fabiospampinato
- License: mit
- Created: 2022-04-03T21:14:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-12T00:10:15.000Z (over 1 year ago)
- Last Synced: 2025-07-10T20:16:33.512Z (12 months ago)
- Topics: cli, colors, terminal, tiny
- Language: TypeScript
- Homepage:
- Size: 20.5 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Tiny Colors
A tiny library providing the basic ANSI colors for the terminal.
## Install
```sh
npm install tiny-colors
```
## Colors
The following color functions are provided.
| Foreground | Background | Modifiers |
| ---------- | ----------- | --------------- |
| `black` | `bgBlack` | `reset` |
| `red` | `bgRed` | `bold` |
| `green` | `bgGreen` | `dim` |
| `yellow` | `bgYellow` | `italic` |
| `blue` | `bgBlue` | `underline` |
| `magenta` | `bgMagenta` | `overline` |
| `cyan` | `bgCyan` | `inverse` |
| `white` | `bgWhite` | `hidden` |
| `gray` | `bgGray` | `strikethrough` |
## Usage
```ts
import colors, {ENABLED} from 'tiny-colors';
// Unchained usage
console.log ( colors.bgMagenta ( colors.italic ( 'foo' ) ) );
// Chained usage
console.log ( colors.bgMagenta.italic ( 'foo' ) );
// Check if colors will actually be displayed
console.log ( ENABLED ); // => true/false
```
## License
MIT © Fabio Spampinato