https://github.com/derhuerst/terminal-styles
Terminal styling using ES6 tagged template literals.
https://github.com/derhuerst/terminal-styles
ansi cli color
Last synced: about 6 hours ago
JSON representation
Terminal styling using ES6 tagged template literals.
- Host: GitHub
- URL: https://github.com/derhuerst/terminal-styles
- Owner: derhuerst
- License: isc
- Created: 2016-08-29T19:13:36.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-01-31T22:35:26.000Z (over 6 years ago)
- Last Synced: 2025-10-03T23:14:37.651Z (10 months ago)
- Topics: ansi, cli, color
- Language: JavaScript
- Homepage: https://github.com/derhuerst/terminal-styles
- Size: 14.6 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# *terminal-styles*
**Terminal styling using ES6 tagged template literals.**
`terminal-styles` tries to be the [sane alternative](https://github.com/yeoman/yo/issues/68) to [`template-colors`](https://github.com/icodeforlove/template-colors), using only [`ansi-styles`](https://github.com/chalk/ansi-styles#usage) under the hood.
Bundled with [browserify](http://browserify.org/), `terminal-styles` has roughly 100 LOC, whereas [`template-colors`](https://github.com/icodeforlove/template-colors) has roughly 2000 LOC.
[](https://www.npmjs.com/package/terminal-styles)
[](https://travis-ci.org/derhuerst/terminal-styles)


[](https://gitter.im/derhuerst)
[](https://patreon.com/derhuerst)
## Installing
```shell
npm install terminal-styles
```
## Usage
`styles.x` works like a closing tag.
```js
const styles = require('terminal-styles')
const {blue, red, underline, x} = styles
console.log(styles `${blue}foo ${red}bar ${underline}baz${x} qux${x} qax${x}`)
```
You can use [all colors & modifiers from `ansi-styles`](https://github.com/chalk/ansi-styles#styles), except `reset` and `inverse`.
## Contributing
If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/terminal-styles/issues).