1
0
mirror of https://github.com/mum4k/termdash.git synced 2025-04-27 13:48:49 +08:00

Adding image and doc entry for the segment display.

This commit is contained in:
Jakub Sobon 2019-02-06 23:18:56 -05:00
parent 3f416675e9
commit c58217af9c
No known key found for this signature in database
GPG Key ID: F2451A77FB05D3B7
3 changed files with 12 additions and 4 deletions

View File

@ -40,7 +40,6 @@ To install this library, run the following:
``` ```
go get -u github.com/mum4k/termdash go get -u github.com/mum4k/termdash
``` ```
# Usage # Usage
@ -129,6 +128,17 @@ go run github.com/mum4k/termdash/widgets/linechart/linechartdemo/linechartdemo.g
[<img src="./images/linechartdemo.gif" alt="linechartdemo" type="image/gif">](widgets/linechart/linechartdemo/linechartdemo.go) [<img src="./images/linechartdemo.gif" alt="linechartdemo" type="image/gif">](widgets/linechart/linechartdemo/linechartdemo.go)
### The SegmentDisplay
Displays text by simulating a 16-segment display. Run the
[linechartdemo](widgets/segmentdisplay/segmentdisplaydemo/segmentdisplaydemo.go).
```go
go run github.com/mum4k/termdash/widgets/segmentdisplay/segmentdisplaydemo/segmentdisplaydemo.go
```
[<img src="./images/segmentdisplay.gif" alt="segmentdisplaydemo" type="image/gif">](widgets/segmentdisplay/segmentdisplaydemo/segmentdisplaydemo.go)
# Contributing # Contributing
If you are willing to contribute, improve the infrastructure or develop a If you are willing to contribute, improve the infrastructure or develop a

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -38,7 +38,7 @@ func clock(ctx context.Context, sd *segmentdisplay.SegmentDisplay) {
select { select {
case <-ticker.C: case <-ticker.C:
now := time.Now() now := time.Now()
nowStr := now.Format("15 04 05") nowStr := now.Format("15 04")
parts := strings.Split(nowStr, " ") parts := strings.Split(nowStr, " ")
spacer := " " spacer := " "
@ -49,8 +49,6 @@ func clock(ctx context.Context, sd *segmentdisplay.SegmentDisplay) {
segmentdisplay.NewChunk(parts[0], segmentdisplay.WriteCellOpts(cell.FgColor(cell.ColorBlue))), segmentdisplay.NewChunk(parts[0], segmentdisplay.WriteCellOpts(cell.FgColor(cell.ColorBlue))),
segmentdisplay.NewChunk(spacer), segmentdisplay.NewChunk(spacer),
segmentdisplay.NewChunk(parts[1], segmentdisplay.WriteCellOpts(cell.FgColor(cell.ColorRed))), segmentdisplay.NewChunk(parts[1], segmentdisplay.WriteCellOpts(cell.FgColor(cell.ColorRed))),
segmentdisplay.NewChunk(spacer),
segmentdisplay.NewChunk(parts[2], segmentdisplay.WriteCellOpts(cell.FgColor(cell.ColorYellow))),
} }
if err := sd.Write(chunks); err != nil { if err := sd.Write(chunks); err != nil {
panic(err) panic(err)