Compare commits
No commits in common. "2a0485b0e9f99ea750ae8a0720d7cf1e7960ae36" and "efedd6522d9f9203a9b89c9b10792fb8b4054017" have entirely different histories.
2a0485b0e9
...
efedd6522d
|
@ -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.
|
|
||||||
|
|
|
@ -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
|
labelXCoordinate := g.Inner.Min.X + (g.Inner.Dx() / 2) - int(float64(len(label))/2)
|
||||||
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 {
|
||||||
|
|
|
@ -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 = 244
|
ColorWhite ui.Color = 15
|
||||||
ColorBlack ui.Color = 0
|
ColorBlack ui.Color = 0
|
||||||
ColorClear ui.Color = -1
|
ColorClear ui.Color = -1
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue