分享
这是一个创建于 的主题,其中的信息可能已经有所发展或是发生改变。
写命令行程序时,希望输出不是单一的颜色,实际上,Linux 这样的系统中,有不少命令输出是有颜色的。那么 Go 编写的程序能做到吗?
事实上,已经有这样的第三方库可以使用:
1、[github.com/fatih/color](https://github.com/fatih/color)
![enter image description here][1]
2、[github.com/aybabtme/rgbterm](https://github.com/aybabtme/rgbterm)
![enter image description here][2]
3、[github.com/daviddengcn/go-colortext](https://github.com/daviddengcn/go-colortext)
欢迎大家总结使用经验。
[1]: http://studygolang.qiniudn.com/ansi_color.png?imageView2/0/w/296/h/200
[2]: http://studygolang.qiniudn.com/ansi_color2.png?imageView2/0/w/396/h/200
有疑问加站长微信联系(非本文作者)
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
关注微信7039 次点击
添加一条新回复
(您需要 后才能回复 没有账号 ?)
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码` - 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传