|
|
@@ -1,16 +1,21 @@
|
|
|
# Color
|
|
|
+
|
|
|
Style terminal text.
|
|
|
|
|
|
## Installation
|
|
|
+
|
|
|
```go get github.com/labstack/gommon/color```
|
|
|
|
|
|
## Windows?
|
|
|
+
|
|
|
Try [cmder](http://bliker.github.io/cmder) or https://github.com/mattn/go-colorable
|
|
|
|
|
|
## Usage
|
|
|
+
|
|
|
[labstack/gommon/color](https://github.com/labstack/gommon/blob/master/color/color_test.go)
|
|
|
|
|
|
### Colored text
|
|
|
+
|
|
|
```go
|
|
|
fmt.Println(color.Black("black"))
|
|
|
fmt.Println(color.Red("red"))
|
|
|
@@ -25,6 +30,7 @@ fmt.Println(color.Grey("grey"))
|
|
|

|
|
|
|
|
|
### Colored background
|
|
|
+
|
|
|
```go
|
|
|
fmt.Println(color.BlackBg("black background", color.Wht))
|
|
|
fmt.Println(color.RedBg("red background"))
|
|
|
@@ -38,6 +44,7 @@ fmt.Println(color.WhiteBg("white background"))
|
|
|

|
|
|
|
|
|
### Emphasis
|
|
|
+
|
|
|
```go
|
|
|
fmt.Println(color.Bold("bold"))
|
|
|
fmt.Println(color.Dim("dim"))
|
|
|
@@ -50,6 +57,7 @@ fmt.Println(color.Strikeout("strikeout"))
|
|
|

|
|
|
|
|
|
### Mix and match
|
|
|
+
|
|
|
```go
|
|
|
fmt.Println(color.Green("bold green with white background", color.B, color.WhtBg))
|
|
|
fmt.Println(color.Red("underline red", color.U))
|