From 5fab51d2a314ecfd447c5d64df661fa069a89635 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 23 May 2019 14:33:55 -0700 Subject: [PATCH] attempts at default colors Signed-off-by: Jeff Carr --- eventChannel.go | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/eventChannel.go b/eventChannel.go index 5926292..744c1ae 100644 --- a/eventChannel.go +++ b/eventChannel.go @@ -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)