diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-10-07 20:40:03 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-10-07 20:40:03 +0900 |
| commit | c0c170ae002b3eb164d5fa5011e3416dddbcb7a3 (patch) | |
| tree | f52fbc8a3356fff3c6b7c95495856bf0e26e6f49 /cmd | |
| parent | 5c1cb0ffaf1c4c6ef2803b7343fc25d5adc1acc6 (diff) | |
| download | term-clock-c0c170ae002b3eb164d5fa5011e3416dddbcb7a3.tar.gz term-clock-c0c170ae002b3eb164d5fa5011e3416dddbcb7a3.tar.zst term-clock-c0c170ae002b3eb164d5fa5011e3416dddbcb7a3.zip | |
feat(timer): make timer blink when the timer has finished
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/timer.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/timer.go b/cmd/timer.go index 5288fe1..693d946 100644 --- a/cmd/timer.go +++ b/cmd/timer.go @@ -3,6 +3,7 @@ package cmd import ( "fmt" "log" + "math" "time" "github.com/spf13/cobra" @@ -12,8 +13,10 @@ import ( func drawTimer(scr *term.Screen, leftTime time.Duration, bgStyle, fgStyle term.Style) { if leftTime <= 0 { + if int(math.Abs(leftTime.Seconds()))%2 == 0 { + bgStyle, fgStyle = fgStyle, bgStyle + } leftTime = 0 - bgStyle, fgStyle = fgStyle, bgStyle } // Clear the entire screen. |
