Skip to content

Commit

Permalink
Merge pull request #14 from ZeusWPI/benq
Browse files Browse the repository at this point in the history
chore: benq monitor lacks colors
  • Loading branch information
Topvennie authored Aug 12, 2024
2 parents 537b4a7 + 3ee7da4 commit 625806d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
22 changes: 12 additions & 10 deletions screen/cammie.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package screen

import (
"fmt"
"scc/utils"
"time"

"github.com/gdamore/tcell/v2"
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion screen/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion screen/spotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (spotify *Spotify) Run() {
spotify.view.SetText(spotify.buffer)
})
}
time.Sleep(50 * time.Millisecond)
time.Sleep(100 * time.Millisecond)
}
}

Expand Down
3 changes: 2 additions & 1 deletion screen/tap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions screen/zess.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 625806d

Please sign in to comment.