当前位置: 首页 > news >正文

网站开发与设计.net最新国际要闻

网站开发与设计.net,最新国际要闻,企业网站程序源码,网站加入联盟gookit/color - Go语言命令行色彩使用库教程 1.安装2.基础颜色(16-color)3.256色彩/RGB风格 1.安装 go get github.com/gookit/color2.基础颜色(16-color) 提供通用的API方法:Print Printf Println Sprint Sprintf 1、例如: color.Yellow.Println(&q…

gookit/color - Go语言命令行色彩使用库教程

  • 1.安装
  • 2.基础颜色(16-color)
  • 3.256色彩/RGB风格

1.安装

go get github.com/gookit/color

2.基础颜色(16-color)

提供通用的API方法:Print Printf Println Sprint Sprintf

1、例如:

color.Yellow.Println("bold message")
color.Blue.Println("bold message")
color.White.Println("bold message")

在这里插入图片描述

2、特例,仅仅设置前景和背景颜色:

// 仅使用前景色
color.FgCyan.Printf("Simple to use %s\n", "color")
// 仅使用背景色
color.BgRed.Printf("Simple to use %s\n", "color")

在这里插入图片描述

3、构建风格

// 完全自定义: 前景色 背景色 选项(字体)
style := color.New(color.FgRed, color.BgBlack, color.OpBold)
style.Println("custom color style")

在这里插入图片描述

4、直接设置控制台属性

// 设置console颜色
_, err := color.Set(color.FgCyan)
if err != nil {return
}
// 输出信息
fmt.Print("message")

在这里插入图片描述

5、扩展风格方法

color.Info.Println("Info message")
color.Note.Println("Note message")
color.Notice.Println("Notice message")

在这里插入图片描述

全部扩展风格:

// Info color style
Info = &Theme{"info", Style{OpReset, FgGreen}}
// Note color style
Note = &Theme{"note", Style{OpBold, FgLightCyan}}
// Warn color style
Warn = &Theme{"warning", Style{OpBold, FgYellow}}
// Light color style
Light = &Theme{"light", Style{FgLightWhite, BgBlack}}
// Error color style
Error = &Theme{"error", Style{FgLightWhite, BgRed}}
// Danger color style
Danger = &Theme{"danger", Style{OpBold, FgRed}}
// Debug color style
Debug = &Theme{"debug", Style{OpReset, FgCyan}}
// Notice color style
Notice = &Theme{"notice", Style{OpBold, FgCyan}}
// Comment color style
Comment = &Theme{"comment", Style{OpReset, FgYellow}}
// Success color style
Success = &Theme{"success", Style{OpBold, FgGreen}}
// Primary color style
Primary = &Theme{"primary", Style{OpReset, FgBlue}}
// Question color style
Question = &Theme{"question", Style{OpReset, FgMagenta}}
// Secondary color style
Secondary = &Theme{"secondary", Style{FgDarkGray}}

6、简约提示风格

color.Info.Tips("Info tips message")
color.Notice.Tips("Notice tips message")
color.Error.Tips("Error tips message")

在这里插入图片描述

7、着重提示风格

color.Info.Prompt("Info prompt message")
color.Error.Prompt("Error prompt message")
color.Danger.Prompt("Danger prompt message")

在这里插入图片描述

8、强调提示风格

color.Warn.Block("Warn block message")
color.Debug.Block("Debug block message")
color.Question.Block("Question block message")

在这里插入图片描述


3.256色彩/RGB风格

参考官方文档:

gookit/color

http://www.15wanjia.com/news/3926.html

相关文章:

  • 武汉网络安全培训武汉seo顾问
  • 网站主持人网站生成
  • 武汉专业网站做网页长尾关键词举例
  • 销售型企业网站安徽seo
  • 乐温州网站建设网站设计开发网站
  • 网站建站合同专业搜索引擎seo服务商
  • 手机咋做网站营销型网站
  • 网站上的动态背景怎么做的重庆森林经典台词
  • 网站建设常见错误最近发生的热点事件
  • javaweb做商业网站网站seo方案
  • 无锡网站外包网络营销推广外包服务
  • 网站界面用什么做的传智播客培训机构官网
  • 郑州东区网站建设网站一键生成
  • 专做校园购物网站百度秒收录软件工具
  • wordpress ubuntu安装百度地图排名怎么优化
  • 网站栏目设置说明seo模拟点击软件源码
  • 北京网站编程培训郑州网站建设公司
  • 做网站容易 但运营难百度seo规则最新
  • 龙湾区网站制作公司拓客最有效方案
  • 代理平台app徐州seo公司
  • 做妇产科网站会计培训班一般多少钱
  • 湖南环保设备公司中企动力网站建设技术支持水果网络营销策划书
  • 个人网站平台包头seo
  • 大连企业做网站大二网页设计作业成品
  • 企业做网站优劣seo站长优化工具
  • 创业做社交网站如何使用免费b站推广网站
  • 软件开发分为哪几个步骤长沙seo免费诊断
  • 涿州建设局网站百度关键词代做排名
  • 潮州外贸网站建设百度网络推广
  • 网站开发项目周期的公司网站建设多少钱