Skip to content

Commit d37380a

Browse files
committed
update readme
1 parent bea68e7 commit d37380a

File tree

4 files changed

+39
-36
lines changed

4 files changed

+39
-36
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Now, 256 colors and RGB colors have also been supported to work in Windows CMD a
3333
- Support working on Windows `cmd` `powerShell` terminal
3434
- Basic colors: `Bold`, `Black`, `White`, `Gray`, `Red`, `Green`, `Yellow`, `Blue`, `Magenta`, `Cyan`
3535
- Additional styles: `Info`, `Note`, `Light`, `Error`, `Danger`, `Notice`, `Success`, `Comment`, `Primary`, `Warning`, `Question`, `Secondary`
36+
- Support by set `NO_COLOR` for disable color or use `FORCE_COLOR` for force open color render.
3637

3738
## GoDoc
3839

README.zh-CN.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ Golang下的命令行色彩使用库, 拥有丰富的色彩渲染输出,通用
2929
-`v1.2.4`**256色(8bit),RGB色彩(24bit)均支持Windows CMD和PowerShell终端**
3030
- 请查看 [this gist](https://gist.github.com/XVilka/8346728) 了解支持RGB色彩的终端
3131
- 通用的API方法:`Print` `Printf` `Println` `Sprint` `Sprintf`
32-
- 同时支持html标签式的颜色渲染. eg: `<green>message</>`
32+
- 同时支持html标签式的颜色渲染.
33+
- 例如: `this an <green>message</>` 标签内部的文本将会渲染为绿色字体
3334
- 基础色彩: `Bold` `Black` `White` `Gray` `Red` `Green` `Yellow` `Blue` `Magenta` `Cyan`
3435
- 扩展风格: `Info` `Note` `Light` `Error` `Danger` `Notice` `Success` `Comment` `Primary` `Warning` `Question` `Secondary`
35-
- 支持Linux、Mac同时兼容Windows系统环境
36+
- 支持通过设置环境变量 `NO_COLOR` 来禁用色彩,或者使用 `FORCE_COLOR` 来强制使用色彩渲染.
37+
- 支持Linux、Mac,同时兼容Windows系统环境
3638

3739
## GoDoc
3840

color.go

+34
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,40 @@ func InnerErrs() []error {
185185
return innerErrs
186186
}
187187

188+
/*************************************************************
189+
* quick use color/style print line message
190+
*************************************************************/
191+
192+
// Infof print message with Info style
193+
func Infof(format string, a ...interface{}) {
194+
Info.Printf(format, a...)
195+
}
196+
197+
// Infoln print message with Info style
198+
func Infoln(a ...interface{}) {
199+
Info.Println(a...)
200+
}
201+
202+
// Errorf print message with Error style
203+
func Errorf(format string, a ...interface{}) {
204+
Error.Printf(format, a...)
205+
}
206+
207+
// Errorln print message with Error style
208+
func Errorln(a ...interface{}) {
209+
Error.Println(a...)
210+
}
211+
212+
// Warnf print message with Warn style
213+
func Warnf(format string, a ...interface{}) {
214+
Warn.Printf(format, a...)
215+
}
216+
217+
// Warnln print message with Warn style
218+
func Warnln(a ...interface{}) {
219+
Warn.Println(a...)
220+
}
221+
188222
/*************************************************************
189223
* render color code
190224
*************************************************************/

style.go

-34
Original file line numberDiff line numberDiff line change
@@ -255,40 +255,6 @@ func GetStyle(name string) Style {
255255
return New()
256256
}
257257

258-
/*************************************************************
259-
* quick use style print message
260-
*************************************************************/
261-
262-
// Infof print message with Info style
263-
func Infof(format string, a ...interface{}) {
264-
Info.Printf(format, a...)
265-
}
266-
267-
// Infoln print message with Info style
268-
func Infoln(a ...interface{}) {
269-
Info.Println(a...)
270-
}
271-
272-
// Errorf print message with Error style
273-
func Errorf(format string, a ...interface{}) {
274-
Error.Printf(format, a...)
275-
}
276-
277-
// Errorln print message with Error style
278-
func Errorln(a ...interface{}) {
279-
Error.Println(a...)
280-
}
281-
282-
// Warnf print message with Warn style
283-
func Warnf(format string, a ...interface{}) {
284-
Warn.Printf(format, a...)
285-
}
286-
287-
// Warnln print message with Warn style
288-
func Warnln(a ...interface{}) {
289-
Warn.Println(a...)
290-
}
291-
292258
/*************************************************************
293259
* color scheme
294260
*************************************************************/

0 commit comments

Comments
 (0)