added current hour highlight
This commit is contained in:
parent
bc1b4a2238
commit
b33d3acf22
1 changed files with 12 additions and 2 deletions
14
main.go
14
main.go
|
|
@ -26,6 +26,8 @@ var (
|
|||
|
||||
hourCellStyle = lipgloss.NewStyle().Width(cellW * 3).Height(cellH).Align(lipgloss.Left).PaddingLeft(1)
|
||||
hourSelectedStyle = hourCellStyle.Copy().Bold(true).Background(lipgloss.Color("12")).Foreground(lipgloss.Color("15"))
|
||||
// New style for current hour highlight (purple background, white text)
|
||||
currentHourStyle = hourCellStyle.Copy().Background(lipgloss.Color("99")).Foreground(lipgloss.Color("15")).Bold(true)
|
||||
)
|
||||
|
||||
type viewMode int
|
||||
|
|
@ -222,11 +224,19 @@ func (m model) viewHourly() string {
|
|||
dateHeader := fmt.Sprintf("Schedule for %04d-%02d-%02d", m.year, m.monthIndex+1, m.selectedDay)
|
||||
out += headerStyle.Render(dateHeader) + "\n\n"
|
||||
|
||||
nowHour := time.Now().Hour()
|
||||
|
||||
for hour := 0; hour < 24; hour++ {
|
||||
label := fmt.Sprintf("%02d:00 - %02d:00", hour, hour+1)
|
||||
if hour == m.hourCursor {
|
||||
|
||||
switch {
|
||||
case hour == m.hourCursor:
|
||||
// selected hour gets blue highlight
|
||||
out += hourSelectedStyle.Render(label) + "\n"
|
||||
} else {
|
||||
case hour == nowHour:
|
||||
// current hour gets purple highlight
|
||||
out += currentHourStyle.Render(label) + "\n"
|
||||
default:
|
||||
out += hourCellStyle.Render(label) + "\n"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue