From c0c170ae002b3eb164d5fa5011e3416dddbcb7a3 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 7 Oct 2024 20:40:03 +0900 Subject: feat(timer): make timer blink when the timer has finished --- cmd/timer.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmd/timer.go') 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. -- cgit v1.2.3-70-g09d2