Skip to content

Commit

Permalink
feat: stlyles
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed May 16, 2022
1 parent 01a255d commit 56c0ebb
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pkg/ui/model.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ui

import (
"fmt"
"time"

"github.com/caarlos0/uhr"
Expand Down Expand Up @@ -39,22 +38,23 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}

var (
bold = lipgloss.NewStyle().Bold(true)
list = lipgloss.NewStyle().Italic(true).MarginLeft(1)
footer = lipgloss.NewStyle().Foreground(lipgloss.Color("gray")).Faint(true)
indigo = lipgloss.AdaptiveColor{Light: "#5A56E0", Dark: "#7571F9"}
fuschia = lipgloss.AdaptiveColor{Light: "#EE6FF8", Dark: "#EE6FF8"}
header = lipgloss.NewStyle().Background(fuschia).Bold(true).Foreground(lipgloss.Color("white")).PaddingRight(1).PaddingLeft(1)
list = lipgloss.NewStyle().MarginLeft(1)
italic = lipgloss.NewStyle().Italic(true).Foreground(indigo)
footer = lipgloss.NewStyle().Foreground(lipgloss.Color("gray")).Faint(true)
)

func (m model) View() string {
s := bold.Render(fmt.Sprintf(
"Hallo!\nHeute ist %s.\nEs ist jetzt %s, aber du kannst auch sagen:",
uhr.Weekday(m.t),
m.t.Format(time.Kitchen)),
)
s += "\n"
s := header.Render("Hallo!") + "\n\n"
s += "Heute ist " + italic.Render(uhr.Weekday(m.t)) + "\n"
s += "Es ist jetzt " + italic.Render(m.t.Format(time.Kitchen)) + ", aber du kannst auch sagen:\n"
for _, l := range uhr.Uhr(m.t) {
s += list.Render(fmt.Sprintf("- "+l)) + "\n"
s += list.Render("- ") + italic.Render(l) + "\n"
}
s += "Es ist in " + italic.Render(uhr.PartOfDay(m.t)) + ".\n"

s += footer.Render("press 'q' to quit")
s += footer.Render("\npress 'q' to quit")
return s
}

0 comments on commit 56c0ebb

Please sign in to comment.