From 3ee7da4a95a8722f51513ea47f32dd425c9d4eeb Mon Sep 17 00:00:00 2001 From: Topvennie Date: Mon, 12 Aug 2024 15:46:39 +0200 Subject: [PATCH] chore: benq monitor lacks colors --- screen/cammie.go | 22 ++++++++++++---------- screen/screen.go | 2 +- screen/spotify.go | 2 +- screen/tap.go | 3 ++- screen/zess.go | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/screen/cammie.go b/screen/cammie.go index 015c794..3fe3ef7 100644 --- a/screen/cammie.go +++ b/screen/cammie.go @@ -2,6 +2,7 @@ package screen import ( "fmt" + "scc/utils" "time" "github.com/gdamore/tcell/v2" @@ -13,18 +14,12 @@ var maxMessages = 20 // Available colors var colors = [...]tcell.Color{ + tcell.ColorWhite, tcell.ColorViolet, tcell.ColorRed, - tcell.ColorIndigo, - tcell.ColorYellow, - tcell.ColorBlue, - tcell.ColorGreen, tcell.ColorOrange, - tcell.ColorLime, + tcell.ColorGreen, tcell.ColorAqua, - tcell.ColorDarkSalmon, - tcell.ColorLightBlue, - tcell.ColorNavajoWhite, } var lastColorIndex = 0 @@ -64,8 +59,15 @@ func (cammie *Cammie) Run() { // Updates the cammie chat // Gets called when a new message is received from the website func (cammie *Cammie) Update(message string) { - color := colors[lastColorIndex].String() - lastColorIndex = (lastColorIndex + 1) % len(colors) + var colorIndex int + for { + colorIndex = utils.RandRange(0, len(colors)) + if colorIndex != lastColorIndex { + break + } + } + + color := colors[colorIndex].String() cammie.screenApp.execute(func() { fmt.Fprintf(cammie.view, "\n[%s]%s", color, message) diff --git a/screen/screen.go b/screen/screen.go index 216318b..83ec373 100644 --- a/screen/screen.go +++ b/screen/screen.go @@ -40,7 +40,7 @@ func NewScreenApp() *ScreenApp { AddItem(screen.Spotify.view, 3, 2, false). AddItem(tview.NewFlex(). AddItem(screen.Cammie.view, 0, 5, false). - AddItem(tview.NewFlex().SetDirection(tview.FlexColumn). + AddItem(tview.NewFlex().SetDirection(tview.FlexRow). AddItem(screen.Tap.view, 0, 1, false). AddItem(screen.Zess.view, 0, 1, false), 0, 4, false), 0, 13, false), true). EnableMouse(false) diff --git a/screen/spotify.go b/screen/spotify.go index 1fa64f7..060136c 100644 --- a/screen/spotify.go +++ b/screen/spotify.go @@ -60,7 +60,7 @@ func (spotify *Spotify) Run() { spotify.view.SetText(spotify.buffer) }) } - time.Sleep(50 * time.Millisecond) + time.Sleep(100 * time.Millisecond) } } diff --git a/screen/tap.go b/screen/tap.go index 6c94d40..480305a 100644 --- a/screen/tap.go +++ b/screen/tap.go @@ -39,10 +39,11 @@ func NewTap(screenApp *ScreenApp) *Tap { tap.view.SetBorder(true).SetTitle(" Tap ") - tap.bar.AddBar("Soft", 0, tcell.ColorBlue) + tap.bar.AddBar("Soft", 0, tcell.ColorAqua) tap.bar.AddBar("Mate", 0, tcell.ColorOrange) tap.bar.AddBar("Beer", 0, tcell.ColorRed) tap.bar.AddBar("Food", 0, tcell.ColorGreen) + tap.bar.SetAxesColor(tcell.ColorWhite) tap.bar.SetAxesLabelColor(tcell.ColorWhite) tap.view.AddItem(tap.bar, 0, 1, false) diff --git a/screen/zess.go b/screen/zess.go index 534bc7f..8bd5a20 100644 --- a/screen/zess.go +++ b/screen/zess.go @@ -39,8 +39,8 @@ func NewZess(screenApp *ScreenApp) *Zess { zess.chart.SetBorder(false) zess.chart.SetLineColor([]tcell.Color{tcell.ColorOrange}) - zess.chart.SetAxesLabelColor(tcell.ColorYellow) - zess.chart.SetAxesColor(tcell.ColorYellow) + zess.chart.SetAxesLabelColor(tcell.ColorWhite) + zess.chart.SetAxesColor(tcell.ColorWhite) zess.chart.SetMarker(tvxwidgets.PlotMarkerBraille) zess.chart.SetDrawYAxisLabelFloat(false) zess.chart.SetData(scans)