Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Apr 7, 2021
1 parent bea68e7 commit d37380a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 36 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -33,6 +33,7 @@ Now, 256 colors and RGB colors have also been supported to work in Windows CMD a
- Support working on Windows `cmd` `powerShell` terminal
- Basic colors: `Bold`, `Black`, `White`, `Gray`, `Red`, `Green`, `Yellow`, `Blue`, `Magenta`, `Cyan`
- Additional styles: `Info`, `Note`, `Light`, `Error`, `Danger`, `Notice`, `Success`, `Comment`, `Primary`, `Warning`, `Question`, `Secondary`
- Support by set `NO_COLOR` for disable color or use `FORCE_COLOR` for force open color render.

## GoDoc

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

## GoDoc

Expand Down
34 changes: 34 additions & 0 deletions color.go
Expand Up @@ -185,6 +185,40 @@ func InnerErrs() []error {
return innerErrs
}

/*************************************************************
* quick use color/style print line message
*************************************************************/

// Infof print message with Info style
func Infof(format string, a ...interface{}) {
Info.Printf(format, a...)
}

// Infoln print message with Info style
func Infoln(a ...interface{}) {
Info.Println(a...)
}

// Errorf print message with Error style
func Errorf(format string, a ...interface{}) {
Error.Printf(format, a...)
}

// Errorln print message with Error style
func Errorln(a ...interface{}) {
Error.Println(a...)
}

// Warnf print message with Warn style
func Warnf(format string, a ...interface{}) {
Warn.Printf(format, a...)
}

// Warnln print message with Warn style
func Warnln(a ...interface{}) {
Warn.Println(a...)
}

/*************************************************************
* render color code
*************************************************************/
Expand Down
34 changes: 0 additions & 34 deletions style.go
Expand Up @@ -255,40 +255,6 @@ func GetStyle(name string) Style {
return New()
}

/*************************************************************
* quick use style print message
*************************************************************/

// Infof print message with Info style
func Infof(format string, a ...interface{}) {
Info.Printf(format, a...)
}

// Infoln print message with Info style
func Infoln(a ...interface{}) {
Info.Println(a...)
}

// Errorf print message with Error style
func Errorf(format string, a ...interface{}) {
Error.Printf(format, a...)
}

// Errorln print message with Error style
func Errorln(a ...interface{}) {
Error.Println(a...)
}

// Warnf print message with Warn style
func Warnf(format string, a ...interface{}) {
Warn.Printf(format, a...)
}

// Warnln print message with Warn style
func Warnln(a ...interface{}) {
Warn.Println(a...)
}

/*************************************************************
* color scheme
*************************************************************/
Expand Down

0 comments on commit d37380a

Please sign in to comment.