https://github.com/azer/styled
console styling library
https://github.com/azer/styled
Last synced: 11 months ago
JSON representation
console styling library
- Host: GitHub
- URL: https://github.com/azer/styled
- Owner: azer
- Created: 2013-05-18T10:22:40.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2016-06-23T22:23:48.000Z (almost 10 years ago)
- Last Synced: 2025-07-02T00:52:15.594Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## styled
the console styling library that does only one thing
## Usage
Anything exported by [ansi-codes](http://github.com/azer/ansi-codes) has a method:
```js
styled.bold('foo')
styled.redBg( styled.yellow('hello!') )
styled.blink('blink blink!!');
```
Shortcut to apply multiple styles:
```js
styled('bold yellow greenBg', 'hello!!')
```
Can be also written as:
```js
styled('bold, yellow, greenBg', 'hello!!')
```
Or
```js
styled('.bold .yellow .greenBg', 'hello!!')
```
## Install
```bash
$ npm install styled
```
## API
```
reset: \033[0m
bold: \033[1m
italic: \033[3m
blink: \033[5m
underline: \033[4m
underlineOff: \033[24m
inverse: \033[7m
inverseOff: \033[27m
strikethrough: \033[9m
strikethroughOff: \033[29m
def: \033[39m
white: \033[37m
black: \033[30m
red: \033[31m
green: \033[32m
blue: \033[34m
yellow: \033[33m
magenta: \033[35m
cyan: \033[36m
defBg: \033[49m
whiteBg: \033[47m
blackBg: \033[40m
redBg: \033[41m
greenBg: \033[42m
blueBg: \033[44m
yellowBg: \033[43m
magentaBg: \033[45m
cyanBg: \033[46m
```
