attempts at default colors

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-23 14:33:55 -07:00
parent 6ba8970d23
commit 5fab51d2a3
1 changed files with 23 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import "io"
import "bytes"
import "strconv"
import "image/color"
import "runtime"
import "github.com/golang/protobuf/proto"
import pb "git.wit.com/wit/witProtobuf"
@ -18,6 +19,16 @@ var mychannel chan *pb.Event
var currentMessage *pb.Event
var windowsTextWhite = color.RGBA{255, 255, 255, 255}
var windowsTextYellow = color.RGBA{200, 200, 0, 200}
var windowsTextRed = color.RGBA{200, 0, 0, 200}
var windowsTextBlue = color.RGBA{0, 100, 200, 100}
var windowsBgGrey = color.RGBA{100, 100, 100, 142}
var windowsBgBlack = color.RGBA{55, 55, 55, 255}
var linuxTextBlue = color.RGBA{0, 100, 200, 100}
var linuxTextBlack = color.RGBA{0, 0, 0, 0}
func initChannel() {
mychannel = make(chan *pb.Event)
}
@ -66,6 +77,13 @@ func ReadReceivedData(data *pb.Event, mh *gui.TableData) {
vms := data.GetVms()
log.Println("ReadReceivedData() Event vms=", vms)
for row, item := range vms {
defaultTextColor := linuxTextBlue
defaultTextYellow := windowsTextYellow
defaultTextBlack := linuxTextBlack
if runtime.GOOS == "windows" {
defaultTextColor = windowsTextRed
defaultTextBlack = windowsTextRed
}
// if (row % 2) == 1 {
if (row == 1) {
mh.Rows[row].HumanData[0].Color = color.RGBA{100, 100, 100, 142} // makes the background of each other row grey
@ -82,15 +100,15 @@ func ReadReceivedData(data *pb.Event, mh *gui.TableData) {
// mh.Rows[row].HumanData[0].Color = nil
}
mh.Rows[row].HumanData[1].Text = item.Name
mh.Rows[row].HumanData[1].Color = color.RGBA{255, 255, 255, 255}
mh.Rows[row].HumanData[1].Color = defaultTextColor
mh.Rows[row].HumanData[2].Text = item.Hostname
mh.Rows[row].HumanData[2].Color = color.RGBA{200, 200, 0, 200}
mh.Rows[row].HumanData[2].Color = defaultTextYellow
mh.Rows[row].HumanData[3].Text = fmt.Sprintf("%d",item.Cpus)
mh.Rows[row].HumanData[3].Color = color.RGBA{200, 0, 0, 200}
mh.Rows[row].HumanData[3].Color = defaultTextColor
mh.Rows[row].HumanData[4].Text = fmt.Sprintf("%d",item.Memory)
mh.Rows[row].HumanData[4].Color = color.RGBA{0, 100, 200, 100}
mh.Rows[row].HumanData[4].Color = defaultTextBlack
mh.Rows[row].HumanData[5].Text = fmt.Sprintf("%d",item.Disk)
mh.Rows[row].HumanData[5].Color = color.RGBA{0, 0, 0, 0}
mh.Rows[row].HumanData[5].Color = defaultTextBlack
mh.Rows[row].HumanData[6].Text = fmt.Sprintf("Details %s",item.Name)
log.Println("\titem=", item)