Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ttacon/chalk
Intuitive package for prettifying terminal/console output. http://godoc.org/github.com/ttacon/chalk
https://github.com/ttacon/chalk
Last synced: about 1 month ago
JSON representation
Intuitive package for prettifying terminal/console output. http://godoc.org/github.com/ttacon/chalk
- Host: GitHub
- URL: https://github.com/ttacon/chalk
- Owner: ttacon
- License: mit
- Created: 2014-07-18T19:38:58.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-08-28T23:55:36.000Z (almost 5 years ago)
- Last Synced: 2024-01-31T02:17:38.228Z (4 months ago)
- Language: Go
- Homepage:
- Size: 151 KB
- Stars: 442
- Watchers: 8
- Forks: 21
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go-extra - chalk - 07-18T19:38:58Z|2019-08-28T23:55:36Z| (Build Automation / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- fucking-awesome-go - :octocat: chalk - Intuitive package for prettifying terminal/console output. :star: 158 :fork_and_knife: 11 (Command Line / Advanced Console UIs)
- awesome-go-projects - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - | - | - | (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go-with-framework - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go-cn - chalk
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - 美化终端/控制台输出的直观包装。 (<span id="命令行-command-line">命令行 Command Line</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go-stars - chalk(stars: 442) - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go. - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go-cn - chalk - 符合直觉的用于美化命令行输出的库 (命令行 / 高级控制台界面)
- awesome-go-with-stars - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-Char - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go-cn - chalk
- repo-1316-awesome-go-cn - chalk
- repo-1211-awesome-go-cn - chalk
- awesome-reader - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - 符合直覺的用於美化命令行輸出的庫 (命令行 / 高級控制台界面)
- awesome-ccamel - ttacon/chalk - Intuitive package for prettifying terminal/console output. http://godoc.org/github.com/ttacon/chalk (Go)
- Go-awesome - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go-cn - chalk
- awesome-go-handwritten - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go2 - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. - :arrow_down:164 - :star:169 (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go-zh - chalk
- awesome-go-cn - chalk
- go-awesome-cn-star - chalk
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. (Command Line / Advanced Console UIs)
- awesome-go - chalk - Intuitive package for prettifying terminal/console output. - ★ 278 (Command Line)
- awesome-go-cn - chalk
README
chalk
=============Chalk is a go package for styling console/terminal output.
Check out godoc for some example usage:
http://godoc.org/github.com/ttacon/chalkThe api is pretty clean, there are default Colors and TextStyles
which can be mixed to create more intense Styles. Styles and Colors
can be printed in normal strings (i.e. ```fmt.Sprintf(chalk.Red)```), but
Styles, Colors and TextStyles are more meant to be used to style specific
text segments (i.e. ```fmt.Println(chalk.Red.Color("this is red")```) or
```fmt.Println(myStyle.Style("this is blue text that is underlined"))```).Examples
=============There are a few examples in the examples directory if you want to see a very
simplified version of what you can do with chalk.The following code:
```go
package mainimport (
"fmt""github.com/ttacon/chalk"
)func main() {
// You can just use colors
fmt.Println(chalk.Red, "Writing in colors", chalk.Cyan, "is so much fun", chalk.Reset)
fmt.Println(chalk.Magenta.Color("You can use colors to color specific phrases"))// You can just use text styles
fmt.Println(chalk.Bold.TextStyle("We can have bold text"))
fmt.Println(chalk.Underline.TextStyle("We can have underlined text"))
fmt.Println(chalk.Bold, "But text styles don't work quite like colors :(")// Or you can use styles
blueOnWhite := chalk.Blue.NewStyle().WithBackground(chalk.White)
fmt.Printf("%s%s%s\n", blueOnWhite, "And they also have backgrounds!", chalk.Reset)
fmt.Println(
blueOnWhite.Style("You can style strings the same way you can color them!"))
fmt.Println(
blueOnWhite.WithTextStyle(chalk.Bold).
Style("You can mix text styles with colors, too!"))// You can also easily make styling functions thanks to go's functional side
lime := chalk.Green.NewStyle().
WithBackground(chalk.Black).
WithTextStyle(chalk.Bold).
Style
fmt.Println(lime("look at this cool lime text!"))
}```
Outputs
![screenshot](https://raw.githubusercontent.com/ttacon/chalk/master/img/chalk_example.png)WARNING
=============This package should be pretty stable (I don't forsee backwards incompatible changes), but I'm not making any promises :)