Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: benq monitor lacks colors #14

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading