Compare commits

...

3 Commits

Author SHA1 Message Date
Ray Elliott 2a0485b0e9 adjust ColorWhite 2021-05-31 19:45:29 +01:00
Ray Elliott 4a4d9b58da move guage label to left 2021-05-31 19:45:18 +01:00
Ray Elliott ec0ef9f907 update readme 2021-05-31 18:55:01 +01:00
3 changed files with 6 additions and 6 deletions

View File

@ -4,5 +4,5 @@
This fork provides This fork provides
* the option of removing borders around gauges (as with the Textbox and Asciibox components), * the option of removing borders around gauges (as with the Textbox and Asciibox components),
* the placement of a gauge's title within its label. * the placement of a gauge's title within its label,
* removal of the status bar.

View File

@ -88,9 +88,9 @@ func (g *Gauge) Draw(buffer *ui.Buffer) {
var label string var label string
if g.percentOnly { if g.percentOnly {
label = fmt.Sprintf("%s: %v%% ", g.title, util.FormatValue(percent, g.scale)) label = fmt.Sprintf(" %s: %v%% ", g.title, util.FormatValue(percent, g.scale))
} else { } else {
label = fmt.Sprintf("%s: %v%% (%v) ", g.title, util.FormatValue(percent, g.scale), util.FormatValue(g.curValue, g.scale)) label = fmt.Sprintf(" %s: %v%% (%v) ", g.title, util.FormatValue(percent, g.scale), util.FormatValue(g.curValue, g.scale))
} }
// draw bar // draw bar
@ -106,7 +106,7 @@ func (g *Gauge) Draw(buffer *ui.Buffer) {
) )
// draw label // draw label
labelXCoordinate := g.Inner.Min.X + (g.Inner.Dx() / 2) - int(float64(len(label))/2) labelXCoordinate := g.Inner.Min.X
labelYCoordinate := g.Inner.Min.Y + ((g.Inner.Dy() - 1) / 2) labelYCoordinate := g.Inner.Min.Y + ((g.Inner.Dy() - 1) / 2)
if labelYCoordinate < g.Inner.Max.Y { if labelYCoordinate < g.Inner.Max.Y {
for i, char := range label { for i, char := range label {

View File

@ -27,7 +27,7 @@ const (
ColorDarkGrey ui.Color = 238 ColorDarkGrey ui.Color = 238
ColorLightGrey ui.Color = 254 ColorLightGrey ui.Color = 254
ColorGrey ui.Color = 242 ColorGrey ui.Color = 242
ColorWhite ui.Color = 15 ColorWhite ui.Color = 244
ColorBlack ui.Color = 0 ColorBlack ui.Color = 0
ColorClear ui.Color = -1 ColorClear ui.Color = -1
) )