Skip to content

Commit

Permalink
Merge branch 'master' into zendesk_module
Browse files Browse the repository at this point in the history
  • Loading branch information
senorprogrammer authored Jul 26, 2018
2 parents ea8148a + 66868a3 commit cc74845
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 28 deletions.
4 changes: 2 additions & 2 deletions wtf/bargraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ func (widget *BarGraph) UpdateRefreshedAt() {
func (widget *BarGraph) addView() {
view := tview.NewTextView()

view.SetBackgroundColor(ColorFor(Config.UString("wtf.colors.background", "black")))
view.SetBackgroundColor(colorFor(Config.UString("wtf.colors.background", "black")))
view.SetBorder(true)
view.SetBorderColor(ColorFor(widget.BorderColor()))
view.SetBorderColor(colorFor(widget.BorderColor()))
view.SetDynamicColors(true)
view.SetTitle(widget.Name)
view.SetWrap(false)
Expand Down
6 changes: 3 additions & 3 deletions wtf/colors.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,16 +420,16 @@ func ASCIItoTviewColors(text string) string {
text, replaceWithHexColorString), `[::b]`), `[-]`)
}

func ColorFor(label string) tcell.Color {
/* -------------------- Unexported Functions -------------------- */

func colorFor(label string) tcell.Color {
if _, ok := colors[label]; ok {
return colors[label]
} else {
return tcell.ColorGreen
}
}

/* -------------------- Unexported Functions -------------------- */

func replaceWithHexColorString(substring string) string {
colorID, err := strconv.Atoi(substring[7 : len(substring)-1])
if err != nil {
Expand Down
6 changes: 1 addition & 5 deletions wtf/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ func NewDisplay(widgets []Wtfable) *Display {
}

display.build(widgets)
display.Grid.SetBackgroundColor(
ColorFor(
Config.UString("wtf.colors.background", "black"),
),
)
display.Grid.SetBackgroundColor(colorFor(Config.UString("wtf.colors.background", "black")))

return &display
}
Expand Down
4 changes: 2 additions & 2 deletions wtf/focus_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (tracker *FocusTracker) blur(idx int) {
view := widget.TextView()
view.Blur()

view.SetBorderColor(ColorFor(widget.BorderColor()))
view.SetBorderColor(colorFor(widget.BorderColor()))
}

func (tracker *FocusTracker) decrement() {
Expand All @@ -90,7 +90,7 @@ func (tracker *FocusTracker) focus(idx int) {
view := widget.TextView()

tracker.App.SetFocus(view)
view.SetBorderColor(ColorFor(Config.UString("wtf.colors.border.focused", "gray")))
view.SetBorderColor(colorFor(Config.UString("wtf.colors.border.focused", "gray")))
}

func (tracker *FocusTracker) focusables() []Wtfable {
Expand Down
4 changes: 2 additions & 2 deletions wtf/text_widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ func (widget *TextWidget) TextView() *tview.TextView {
func (widget *TextWidget) addView() {
view := tview.NewTextView()

view.SetBackgroundColor(ColorFor(Config.UString("wtf.colors.background", "black")))
view.SetBackgroundColor(colorFor(Config.UString("wtf.colors.background", "black")))
view.SetBorder(true)
view.SetBorderColor(ColorFor(widget.BorderColor()))
view.SetBorderColor(colorFor(widget.BorderColor()))
view.SetDynamicColors(true)
view.SetTitle(widget.Name)
view.SetWrap(false)
Expand Down
14 changes: 0 additions & 14 deletions wtftests/colors_test.go

This file was deleted.

0 comments on commit cc74845

Please sign in to comment.