本文整理匯總了Golang中github.com/jroimartin/gocui.Gui.BgColor方法的典型用法代碼示例。如果您正苦於以下問題:Golang Gui.BgColor方法的具體用法?Golang Gui.BgColor怎麽用?Golang Gui.BgColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/jroimartin/gocui.Gui
的用法示例。
在下文中一共展示了Gui.BgColor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: layout
func layout(g *gocui.Gui) error {
maxX, maxY := g.Size()
columnX := maxX / 3
g.BgColor = gocui.ColorWhite
g.FgColor = gocui.ColorBlack
g.RenderFrames = false
if v, err := g.SetView("status", -1, -1, maxX, 1); err != nil {
if err != gocui.ErrorUnkView {
return err
}
v.FgColor = gocui.ColorWhite
v.BgColor = gocui.ColorBlack
}
if v, err := g.SetView("counterHeader", -1, 0, columnX, maxY); err != nil {
if err != gocui.ErrorUnkView {
return err
}
v.FgColor = gocui.ColorWhite
v.BgColor = gocui.ColorBlue
fmt.Fprintf(v, "Counters")
}
if _, err := g.SetView("counters", -1, 1, columnX, maxY); err != nil {
if err != gocui.ErrorUnkView {
return err
}
}
if v, err := g.SetView("gaugeHeader", columnX, 0, columnX*2, maxY); err != nil {
if err != gocui.ErrorUnkView {
return err
}
v.FgColor = gocui.ColorWhite
v.BgColor = gocui.ColorCyan
fmt.Fprintf(v, "Gauges")
}
if _, err := g.SetView("gauges", columnX, 1, columnX*2, maxY); err != nil {
if err != gocui.ErrorUnkView {
return err
}
}
if v, err := g.SetView("timerHeader", columnX*2, 0, maxX-1, maxY); err != nil {
if err != gocui.ErrorUnkView {
return err
}
v.FgColor = gocui.ColorWhite
v.BgColor = gocui.ColorMagenta
fmt.Fprintf(v, "Timers")
}
if _, err := g.SetView("timers", (columnX * 2), 1, maxX-1, maxY); err != nil {
if err != gocui.ErrorUnkView {
return err
}
}
return nil
}
示例2: layout
func (c *controller) layout(g *gocui.Gui) error {
g.BgColor = gocui.ColorDefault
maxX, maxY := g.Size()
if len(c.columns) == 0 {
return errors.New("No columns defined")
}
colWidth := maxX / len(c.columns)
for i, col := range c.columns {
v, err := g.SetView(col.name, i*colWidth, 0, ((i+1)*colWidth)-1, maxY-2)
if err != nil {
if err != gocui.ErrorUnkView {
return err
}
}
v.Clear()
v.Write([]byte(col.name + ": \n\n"))
err = col.CreateViews(g, v)
if err != nil {
return err
}
}
status, err := g.SetView("statusbar", 0, maxY-2, maxX-1, maxY+1)
if err != nil {
if err != gocui.ErrorUnkView {
return err
}
status.Frame = false
status.BgColor = gocui.ColorBlack
status.FgColor = gocui.ColorDefault | gocui.AttrBold
}
status.Clear()
if c.debugOn {
status.Write([]byte(debug))
} else {
status.Write(c.statusBar(maxX))
}
return nil
}