mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Better color config standardization. It's not just random anymore
This commit is contained in:
parent
d7bc26684a
commit
3de253bd0d
@ -25,10 +25,10 @@ func (widget *Widget) display(clocks []Clock) {
|
||||
}
|
||||
|
||||
func (widget *Widget) rowColor(idx int) string {
|
||||
rowCol := Config.UString("wtf.mods.clocks.rowcolors.even", "lightblue")
|
||||
rowCol := Config.UString("wtf.mods.clocks.colors.row.even", "lightblue")
|
||||
|
||||
if idx%2 == 0 {
|
||||
rowCol = Config.UString("wtf.mods.clocks.rowcolors.odd", "white")
|
||||
rowCol = Config.UString("wtf.mods.clocks.colors.row.odd", "white")
|
||||
}
|
||||
|
||||
return rowCol
|
||||
|
@ -2,8 +2,12 @@ package todo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
//"github.com/gdamore/tcell"
|
||||
)
|
||||
|
||||
const checkWidth = 4
|
||||
|
||||
func (widget *Widget) display() {
|
||||
widget.View.Clear()
|
||||
|
||||
@ -12,21 +16,36 @@ func (widget *Widget) display() {
|
||||
foreColor, backColor := "white", "black"
|
||||
|
||||
if item.Checked {
|
||||
foreColor = "gray"
|
||||
foreColor = Config.UString("wtf.mods.todo.colors.checked", "white")
|
||||
}
|
||||
|
||||
if widget.View.HasFocus() && idx == widget.list.selected {
|
||||
foreColor, backColor = "black", "olive"
|
||||
foreColor = Config.UString("wtf.mods.todo.colors.highlight.fore", "black")
|
||||
backColor = Config.UString("wtf.mods.todo.colors.highlight.back", "white")
|
||||
}
|
||||
|
||||
str = str + fmt.Sprintf(
|
||||
"[%s:%s]|%s| %s[white]\n",
|
||||
"[%s:%s]|%s| %s[white]",
|
||||
foreColor,
|
||||
backColor,
|
||||
item.CheckMark(),
|
||||
item.Text,
|
||||
)
|
||||
|
||||
str = widget.padLine(str, item) + "\n"
|
||||
}
|
||||
|
||||
fmt.Fprintf(widget.View, "%s", str)
|
||||
}
|
||||
|
||||
// Pad with spaces to get full-line highlighting
|
||||
func (widget *Widget) padLine(str string, item *Item) string {
|
||||
_, _, w, _ := widget.View.GetInnerRect()
|
||||
|
||||
padSize := w - checkWidth - len(item.Text)
|
||||
if padSize < 0 {
|
||||
padSize = 0
|
||||
}
|
||||
|
||||
return str + strings.Repeat(" ", padSize)
|
||||
}
|
||||
|
@ -53,7 +53,15 @@ func (widget *Widget) temperatures(cityData *owm.CurrentWeatherData) string {
|
||||
tempUnit := Config.UString("wtf.mods.weather.tempUnit", "C")
|
||||
|
||||
str := fmt.Sprintf("%8s: %4.1f° %s\n", "High", cityData.Main.TempMax, tempUnit)
|
||||
str = str + fmt.Sprintf("%8s: [green]%4.1f° %s[white]\n", "Current", cityData.Main.Temp, tempUnit)
|
||||
|
||||
str = str + fmt.Sprintf(
|
||||
"%8s: [%s]%4.1f° %s[white]\n",
|
||||
"Current",
|
||||
Config.UString("wtf.mods.weather.colors.current", "green"),
|
||||
cityData.Main.Temp,
|
||||
tempUnit,
|
||||
)
|
||||
|
||||
str = str + fmt.Sprintf("%8s: %4.1f° %s\n", "Low", cityData.Main.TempMin, tempUnit)
|
||||
|
||||
return str
|
||||
|
@ -40,7 +40,7 @@ func (tracker *FocusTracker) Prev() {
|
||||
func (tracker *FocusTracker) blur(idx int) {
|
||||
view := tracker.Widgets[idx].TextView()
|
||||
view.Blur()
|
||||
view.SetBorderColor(ColorFor(Config.UString("wtf.border.normal", "gray")))
|
||||
view.SetBorderColor(ColorFor(Config.UString("wtf.colors.border.normal", "gray")))
|
||||
}
|
||||
|
||||
func (tracker *FocusTracker) decrement() {
|
||||
@ -54,7 +54,7 @@ func (tracker *FocusTracker) decrement() {
|
||||
func (tracker *FocusTracker) focus(idx int) {
|
||||
view := tracker.Widgets[idx].TextView()
|
||||
tracker.App.SetFocus(view)
|
||||
view.SetBorderColor(ColorFor(Config.UString("wtf.border.focus", "gray")))
|
||||
view.SetBorderColor(ColorFor(Config.UString("wtf.colors.border.focus", "gray")))
|
||||
}
|
||||
|
||||
func (tracker *FocusTracker) increment() {
|
||||
|
@ -63,7 +63,7 @@ func (widget *TextWidget) addView() {
|
||||
view := tview.NewTextView()
|
||||
|
||||
view.SetBorder(true)
|
||||
view.SetBorderColor(ColorFor(Config.UString("wtf.border.normal")))
|
||||
view.SetBorderColor(ColorFor(Config.UString("wtf.colors.border.normal")))
|
||||
view.SetDynamicColors(true)
|
||||
view.SetTitle(widget.Name)
|
||||
view.SetWrap(false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user