diff options
| author | Fatih Arslan <ftharsln@gmail.com> | 2014-02-24 18:01:46 +0000 |
|---|---|---|
| committer | Fatih Arslan <ftharsln@gmail.com> | 2014-02-24 18:01:46 +0000 |
| commit | 36f10a0700b59e88462ae10d7a79b7d4759e22b1 (patch) | |
| tree | 287dde7cdd3810c46eae39ebc21ab80c0a186ddf /README.md | |
| parent | 6c84e7d11c45df74246b9b8adae7a3940a6bfc2b (diff) | |
| download | colour-36f10a0700b59e88462ae10d7a79b7d4759e22b1.tar.gz colour-36f10a0700b59e88462ae10d7a79b7d4759e22b1.tar.bz2 | |
Fix Readme.md, add colorstring helper functions
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -25,7 +25,6 @@ color.Blue("Prints %s in blue.", "text") // These are using by default foreground colors. color.Red("We have red") -color.Yellow("Yellow color too!") color.Magenta("And many others ..") ``` @@ -41,7 +40,6 @@ c.Println("Prints cyan text with an underline.") d := color.New(color.FgCyan, color.Bold) d.Printf("This prints bold cyan %s\n", "too!.") - // Mix up foreground and background colors, create new mixes! red := color.New(color.FgRed) @@ -69,12 +67,16 @@ notice("don't forget this...") ```go // Create SprintXxx functions to mix strings with other non-colorized strings: -yellow := New(FgYellow).SprintFunc() -red := New(FgRed).SprintFunc() +yellow := color.New(color.FgYellow).SprintFunc() +red := color.New(color.FgRed).SprintFunc() fmt.Printf("this is a %s and this is %s.\n", yellow("warning"), red("error")) -info := New(FgWhite, BgGreen).SprintFunc() +info := color.New(color.FgWhite, color.BgGreen).SprintFunc() fmt.Printf("this %s rocks!\n", info("package")) + +// use helper functions +fmt.Printf("this", color.RedString("warning"), "should be not neglected.") +fmt.Printf(color.GreenString("Info:"), "an important message." ) ``` ### Plug into existing code |
