diff options
| author | Fatih Arslan <ftharsln@gmail.com> | 2014-02-18 10:52:23 +0000 |
|---|---|---|
| committer | Fatih Arslan <ftharsln@gmail.com> | 2014-02-18 10:52:23 +0000 |
| commit | c297f2223f094d003de912e2b9efe6b843d4ad77 (patch) | |
| tree | b2f685ff0ad908378a80083e426e6d6b205e4de1 /README.md | |
| parent | e653ecf96db821ff7c2dc9ff5532cfcd92a0ccfc (diff) | |
| download | colour-c297f2223f094d003de912e2b9efe6b843d4ad77.tar.gz colour-c297f2223f094d003de912e2b9efe6b843d4ad77.tar.bz2 | |
Add PrintFunc.. functions and update readme.md
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -4,6 +4,7 @@ Color let you use colorized outputs in terms of [ANSI Escape Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors). The API can be used in several way, pick one one that suits you. +The package is under ongoing development, checkout for regular updates. ## Install @@ -51,6 +52,19 @@ whiteBackground := red.Add(color.BgWhite) whiteBackground.Println("Red text with White background.") ``` +### Custom print functions + +```go +// Create a custom print function for convenient +red := color.New(color.FgRed).PrintfFunc() +red("warning") +red("error: %s", err) + +// Mix up multiple attributes +notice := color.New(color.Bold, color.FgGreen).PrintlnFunc() +notice("don't forget this...") +``` + ### Plug into existing code ```go @@ -71,8 +85,8 @@ fmt.Println("All text will be now bold magenta.") ## Todo -* Add partial coloring of lines. -* Save/Return previous values +* Save/Return previous values +* Implement SprintXxx functions() ## Credits |
