1package main 2 3import ( 4 "fmt" 5 "github.com/xyproto/textoutput" 6) 7 8func main() { 9 // Enable colors, enable output 10 o := textoutput.NewTextOutput(true, true) 11 12 s := o.Tags("<red>hi</red> and <lightblue>hello</lightblue>") 13 14 fmt.Println(s) 15 16 for _, cc := range o.Extract(s) { 17 fmt.Printf("letter: %d\tcolor attributes: %v\n", cc.R, cc.A.Ints()) 18 } 19} 20