8colors 中文文档教程

发布于 7年前 浏览 53 项目主页 更新于 3年前

8 COLORS

像魔术一样的彩色终端控制台(可链接)

Installation

npm install --save 8colors

Usage

Example

const c = require('8colors')

var title ='WARNING'

//straight up 
console.log(c.green('color me green'))

console.log(c.red(title))

//chaining
console.log (c.b('color me blue').m(' and I am Magenta').bm(' I am bright Magenta').end())

//background color
console.log(c.R().w(title).end())

console.log(c.R().w(title).by(' You are using and awesome library!').end())

COLORS and Helper functions

Non Chained -- Straight up output

method(string)TEXT COLOR
black(string)Black
red(string)Red
green(string)Green
yellow(string)Yellow
blue(string)Blue
magenta(string)Magenta
cyan(string)Cyan
white(string)White

Chained approached

Foreground Color (Standard)

Method (string)Foreground Color
k(string)Black
r(string)red
g(string)Green
b(string)Blue
y(string)Yellow
m(string)Magenta
c(string)Cyan
w(string)White

Foreground Color (Bright)

Method(string)Foreground Bright Color (Hi intensity)
bk(string)Bright Black
br(string)Bright Red
bg(string)Bright Green
bb(string)Bright Blue
by(string)Bright Yellow
bm(string)Bright Magenta
bc(string)Bright Cyan
bw(string)Bright White

Background Color (STANDARD)

Method(string)Background Bright Color (Standard)
K(string)Black
R(string)Red
G(string)Green
B(string)Blue
Y(string)Yellow
M(string)Magenta
C(string)Cyan
W(string)White

Background Color (Bright)

Method(string)Background Bright Color (Hi intensity)
BK(string)Bright Black
BR(string)Bright Red
BG(string)Bright Green
BB(string)Bright Blue
BY(string)Bright Yellow
BM(string)Bright Magenta
BC(string)Bright Cyan
BW(string)Bright White

Helper Functions

methodFunction
end()denotes end of the chain and output result
V(string)inverse foreground and background color (not tested on all terminal)
_(string)Underline (not tested on all terminal)
I(string)make the text color intense (not tested on all terminal)
blkmake the text slow blink (not tested on all terminal)
rblinkmake the text rapid blink (not tested on all terminal)

Reference

License

麻省理工学院 © 2018 John Martin R. Disuanco

8 COLORS

Color Terminal Console like magic (Chain-able)

Installation

npm install --save 8colors

Usage

Example

const c = require('8colors')

var title ='WARNING'

//straight up 
console.log(c.green('color me green'))

console.log(c.red(title))

//chaining
console.log (c.b('color me blue').m(' and I am Magenta').bm(' I am bright Magenta').end())

//background color
console.log(c.R().w(title).end())

console.log(c.R().w(title).by(' You are using and awesome library!').end())

COLORS and Helper functions

Non Chained -- Straight up output

method(string)TEXT COLOR
black(string)Black
red(string)Red
green(string)Green
yellow(string)Yellow
blue(string)Blue
magenta(string)Magenta
cyan(string)Cyan
white(string)White

Chained approached

Foreground Color (Standard)

Method (string)Foreground Color
k(string)Black
r(string)red
g(string)Green
b(string)Blue
y(string)Yellow
m(string)Magenta
c(string)Cyan
w(string)White

Foreground Color (Bright)

Method(string)Foreground Bright Color (Hi intensity)
bk(string)Bright Black
br(string)Bright Red
bg(string)Bright Green
bb(string)Bright Blue
by(string)Bright Yellow
bm(string)Bright Magenta
bc(string)Bright Cyan
bw(string)Bright White

Background Color (STANDARD)

Method(string)Background Bright Color (Standard)
K(string)Black
R(string)Red
G(string)Green
B(string)Blue
Y(string)Yellow
M(string)Magenta
C(string)Cyan
W(string)White

Background Color (Bright)

Method(string)Background Bright Color (Hi intensity)
BK(string)Bright Black
BR(string)Bright Red
BG(string)Bright Green
BB(string)Bright Blue
BY(string)Bright Yellow
BM(string)Bright Magenta
BC(string)Bright Cyan
BW(string)Bright White

Helper Functions

methodFunction
end()denotes end of the chain and output result
V(string)inverse foreground and background color (not tested on all terminal)
_(string)Underline (not tested on all terminal)
I(string)make the text color intense (not tested on all terminal)
blkmake the text slow blink (not tested on all terminal)
rblinkmake the text rapid blink (not tested on all terminal)

Reference

License

MIT © 2018 John Martin R. Disuanco

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文