本文整理匯總了Golang中github.com/minio/mc/pkg/console.SetCustomPalette函數的典型用法代碼示例。如果您正苦於以下問題:Golang SetCustomPalette函數的具體用法?Golang SetCustomPalette怎麽用?Golang SetCustomPalette使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了SetCustomPalette函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setMainPalette
func setMainPalette(style string) {
console.SetCustomPalette(map[string]*color.Color{
"Debug": color.New(color.FgWhite, color.Faint, color.Italic),
"Fatal": color.New(color.FgRed, color.Italic, color.Bold),
"Error": color.New(color.FgYellow, color.Italic),
"Info": color.New(color.FgGreen, color.Bold),
"Print": color.New(),
"PrintC": color.New(color.FgGreen, color.Bold),
})
if style == "light" {
console.SetCustomPalette(map[string]*color.Color{
"Debug": color.New(color.FgWhite, color.Faint, color.Italic),
"Fatal": color.New(color.FgWhite, color.Italic, color.Bold),
"Error": color.New(color.FgWhite, color.Italic, color.Bold),
"Info": color.New(color.FgWhite, color.Bold),
"Print": color.New(),
"PrintC": color.New(color.FgWhite, color.Bold),
})
return
}
/// Add more styles here
if style == "nocolor" {
// All coloring options exhausted, setting nocolor safely
console.SetNoColor()
}
}
示例2: setAccessPalette
func setAccessPalette(style string) {
console.SetCustomPalette(map[string]*color.Color{
"Access": color.New(color.FgGreen, color.Bold),
})
if style == "light" {
console.SetCustomPalette(map[string]*color.Color{
"Access": color.New(color.FgWhite, color.Bold),
})
}
if style == "nocolor" {
// ALl coloring options exhausted, setting nocolor safely
console.SetNoColor()
}
}
示例3: setMakeBucketPalette
func setMakeBucketPalette(style string) {
console.SetCustomPalette(map[string]*color.Color{
"MakeBucket": color.New(color.FgGreen, color.Bold),
})
if style == "light" {
console.SetCustomPalette(map[string]*color.Color{
"MakeBucket": color.New(color.FgWhite, color.Bold),
})
return
}
if style == "nocolor" {
// All coloring options exhausted, setting nocolor safely
console.SetNoColor()
}
}
示例4: setCopyPalette
func setCopyPalette(style string) {
console.SetCustomPalette(map[string]*color.Color{
"Copy": color.New(color.FgGreen, color.Bold),
})
if style == "light" {
console.SetCustomPalette(map[string]*color.Color{
"Copy": color.New(color.FgWhite, color.Bold),
})
return
}
/// Add more styles here
if style == "nocolor" {
// All coloring options exhausted, setting nocolor safely
console.SetNoColor()
}
}
示例5: newProgressBar
// newProgressBar - instantiate a pbBar.
func newProgressBar(total int64) *barSend {
console.SetCustomPalette(map[string]*color.Color{
"Bar": color.New(color.FgGreen, color.Bold),
})
cmdCh := make(chan barMsg)
finishCh := make(chan bool)
go func(total int64, cmdCh <-chan barMsg, finishCh chan<- bool) {
var started bool
var totalBytesRead int64 // total amounts of bytes read
bar := pb.New64(total)
bar.SetUnits(pb.U_BYTES)
bar.SetRefreshRate(time.Millisecond * 125)
bar.NotPrint = true
bar.ShowSpeed = true
bar.Callback = func(s string) {
console.Print(console.Colorize("Bar", "\r"+s))
}
switch runtime.GOOS {
case "linux":
bar.Format("┃▓█░┃")
// bar.Format("█▓▒░█")
case "darwin":
bar.Format(" ▓ ░ ")
default:
bar.Format("[=> ]")
}
for msg := range cmdCh {
switch msg.Op {
case pbBarSetCaption:
bar.Prefix(fixateBarCaption(msg.Arg.(string), getFixedWidth(bar.GetWidth(), 18)))
case pbBarProgress:
if bar.Total > 0 && !started {
started = true
bar.Start()
}
if msg.Arg.(int64) > 0 {
totalBytesRead += msg.Arg.(int64)
bar.Add64(msg.Arg.(int64))
}
case pbBarPutError:
if totalBytesRead > msg.Arg.(int64) {
bar.Set64(totalBytesRead - msg.Arg.(int64))
}
case pbBarGetError:
if msg.Arg.(int64) > 0 {
bar.Add64(msg.Arg.(int64))
}
case pbBarFinish:
if started {
bar.Finish()
}
finishCh <- true
return
}
}
}(total, cmdCh, finishCh)
return &barSend{cmdCh, finishCh}
}
示例6: setSessionPalette
func setSessionPalette(style string) {
console.SetCustomPalette(map[string]*color.Color{
"Command": color.New(color.FgWhite, color.Bold),
"SessionID": color.New(color.FgYellow, color.Bold),
"SessionTime": color.New(color.FgGreen),
"ClearSession": color.New(color.FgGreen, color.Bold),
})
if style == "light" {
console.SetCustomPalette(map[string]*color.Color{
"Command": color.New(color.FgWhite, color.Bold),
"SessionID": color.New(color.FgWhite, color.Bold),
"SessionTime": color.New(color.FgWhite, color.Bold),
"ClearSession": color.New(color.FgWhite, color.Bold),
})
return
}
/// Add more styles here
if style == "nocolor" {
// All coloring options exhausted, setting nocolor safely
console.SetNoColor()
}
}
示例7: setListPalette
func setListPalette(style string) {
console.SetCustomPalette(map[string]*color.Color{
"File": color.New(color.FgWhite),
"Dir": color.New(color.FgCyan, color.Bold),
"Size": color.New(color.FgYellow),
"Time": color.New(color.FgGreen),
})
if style == "light" {
console.SetCustomPalette(map[string]*color.Color{
"File": color.New(color.FgWhite, color.Bold),
"Dir": color.New(color.FgWhite, color.Bold),
"Size": color.New(color.FgWhite, color.Bold),
"Time": color.New(color.FgWhite, color.Bold),
})
return
}
/// Add more styles here
if style == "nocolor" {
// All coloring options exhausted, setting nocolor safely
console.SetNoColor()
}
}
示例8: setDiffPalette
func setDiffPalette(style string) {
console.SetCustomPalette(map[string]*color.Color{
"DiffMessage": color.New(color.FgGreen, color.Bold),
"DiffOnlyInFirst": color.New(color.FgRed, color.Bold),
"DiffType": color.New(color.FgYellow, color.Bold),
"DiffSize": color.New(color.FgMagenta, color.Bold),
})
if style == "light" {
console.SetCustomPalette(map[string]*color.Color{
"DiffMessage": color.New(color.FgWhite, color.Bold),
"DiffOnlyInFirst": color.New(color.FgWhite, color.Bold),
"DiffType": color.New(color.FgWhite, color.Bold),
"DiffSize": color.New(color.FgWhite, color.Bold),
})
return
}
/// Add more styles here
if style == "nocolor" {
// All coloring options exhausted, setting nocolor safely
console.SetNoColor()
}
}
示例9: setSharePalette
func setSharePalette(style string) {
console.SetCustomPalette(map[string]*color.Color{
"Share": color.New(color.FgGreen, color.Bold),
"Expires": color.New(color.FgRed, color.Bold),
"URL": color.New(color.FgCyan, color.Bold),
"File": color.New(color.FgRed, color.Bold),
})
if style == "light" {
console.SetCustomPalette(map[string]*color.Color{
"Share": color.New(color.FgWhite, color.Bold),
"Expires": color.New(color.FgWhite, color.Bold),
"URL": color.New(color.FgWhite, color.Bold),
"File": color.New(color.FgWhite, color.Bold),
})
return
}
/// Add more styles here
if style == "nocolor" {
// All coloring options exhausted, setting nocolor safely
console.SetNoColor()
}
}
示例10: setConfigHostPalette
func setConfigHostPalette(style string) {
console.SetCustomPalette(map[string]*color.Color{
"Host": color.New(color.FgCyan, color.Bold),
"API": color.New(color.FgYellow, color.Bold),
"HostMessage": color.New(color.FgGreen, color.Bold),
"AccessKeyID": color.New(color.FgBlue, color.Bold),
"SecretAccessKey": color.New(color.FgRed, color.Bold),
})
if style == "light" {
console.SetCustomPalette(map[string]*color.Color{
"Host": color.New(color.FgWhite, color.Bold),
"API": color.New(color.FgWhite, color.Bold),
"HostMessage": color.New(color.FgWhite, color.Bold),
"AccessKeyID": color.New(color.FgWhite, color.Bold),
"SecretAccessKey": color.New(color.FgWhite, color.Bold),
})
return
}
/// Add more styles here
if style == "nocolor" {
// All coloring options exhausted, setting nocolor safely
console.SetNoColor()
}
}