// Print with default helper functions
color.Cyan("Prints text in cyan.")// A newline will be appended automatically
color.Blue("Prints %s in blue.","text")// These are using the default foreground colors
color.Red("We have red")
color.Magenta("And many others ..")
本地电脑测试
/main.gopackage main
import("github.com/fatih/color")funcmain(){// Print with default helper functions
color.Cyan("Prints text in cyan.")// A newline will be appended automatically
color.Blue("Prints %s in blue.","text")// These are using the default foreground colors
color.Red("We have red")
color.Magenta("And many others ..")}
3.代码解读
a.从一条代码开始解读
// 用青色打印内容
color.Cyan("Prints text in cyan.")// 按住ctrl键,点击 Cyan 函数代码