Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jessety/simple-log-colors
Extremely lightweight zero-dependency library for coloring Node terminal output
https://github.com/jessety/simple-log-colors
Last synced: 5 days ago
JSON representation
Extremely lightweight zero-dependency library for coloring Node terminal output
- Host: GitHub
- URL: https://github.com/jessety/simple-log-colors
- Owner: jessety
- License: mit
- Created: 2019-01-04T05:04:31.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2021-05-16T03:38:13.000Z (over 3 years ago)
- Last Synced: 2024-09-17T07:52:01.153Z (about 2 months ago)
- Language: TypeScript
- Homepage: https://npmjs.com/package/simple-log-colors
- Size: 25.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-log-colors
Extremely lightweight zero-dependency library for coloring Node terminal output
[![build](https://github.com/jessety/simple-log-colors/workflows/ci/badge.svg)](https://github.com/jessety/simple-log-colors/actions)
[![npm](https://img.shields.io/npm/v/simple-log-colors.svg)](https://www.npmjs.com/package/simple-log-colors)
[![license](https://img.shields.io/github/license/jessety/simple-log-colors.svg)](https://github.com/jessety/simple-log-colors/blob/main/LICENSE)## Install
```bash
npm install simple-log-colors
```## Usage
```javascript
// Modules
import colors from 'simple-log-colors';// CommonJS
const colors = require('simple-log-colors');
```Template strings
```javascript
console.log(`Hello, ${colors.blue('world')}!`);
console.log(`Everything looks ${colors.cyan('better')} with a little ${colors.magenta('color')}!`);
```Concatenation
```javascript
console.log(colors.redBackground('WARNING') + ' things are getting pretty ' + colors.yellow('colorful') + ' around here.');
```Functions
```javascript
const { red, green, blue } = require('simple-log-colors');console.log(`${red('Error')} the ${green('POST')} request to the ${blue('/test')} route was not signed properly.`);
```## Colors
The following colors are supported:
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`All of these colors are also supported as background colors. For background colors, add the suffix `Background` onto a supported color.
```javascript
console.error(colors.redBackground('ERROR'));
```## License
MIT © Jesse Youngblood