update dependencies

This commit is contained in:
Cory Bennett
2017-09-06 11:35:00 -07:00
parent 9453179251
commit aa876cd588
308 changed files with 46154 additions and 33733 deletions
+24 -9
View File
@@ -1,9 +1,16 @@
package ansi
import (
"fmt"
"sort"
colorable "github.com/mattn/go-colorable"
)
// PrintStyles prints all style combinations to the terminal.
func PrintStyles() {
oldPlain := plain
plain = false
// for compatibility with Windows, not needed for *nix
stdout := colorable.NewColorableStdout()
bgColors := []string{
"",
@@ -16,14 +23,22 @@ func PrintStyles() {
":cyan",
":white",
}
for fg := range Colors {
keys := make([]string, 0, len(Colors))
for k := range Colors {
keys = append(keys, k)
}
sort.Sort(sort.StringSlice(keys))
for _, fg := range keys {
for _, bg := range bgColors {
println(padColor(fg, []string{"" + bg, "+b" + bg, "+bh" + bg, "+u" + bg}))
println(padColor(fg, []string{"+uh" + bg, "+B" + bg, "+Bb" + bg /* backgrounds */, "" + bg + "+h"}))
println(padColor(fg, []string{"+b" + bg + "+h", "+bh" + bg + "+h", "+u" + bg + "+h", "+uh" + bg + "+h"}))
fmt.Fprintln(stdout, padColor(fg, []string{"" + bg, "+b" + bg, "+bh" + bg, "+u" + bg}))
fmt.Fprintln(stdout, padColor(fg, []string{"+s" + bg, "+i" + bg}))
fmt.Fprintln(stdout, padColor(fg, []string{"+uh" + bg, "+B" + bg, "+Bb" + bg /* backgrounds */, "" + bg + "+h"}))
fmt.Fprintln(stdout, padColor(fg, []string{"+b" + bg + "+h", "+bh" + bg + "+h", "+u" + bg + "+h", "+uh" + bg + "+h"}))
}
}
plain = oldPlain
}
func pad(s string, length int) string {
@@ -33,10 +48,10 @@ func pad(s string, length int) string {
return s
}
func padColor(s string, styles []string) string {
func padColor(color string, styles []string) string {
buffer := ""
for _, style := range styles {
buffer += Color(pad(s+style, 20), s+style)
buffer += Color(pad(color+style, 20), color+style)
}
return buffer
}