commit d8cef5ababdcdad75b59cad81dd9ec95c5177791
parent b1d177ff74d881140272caf63b64131525b74bb6
Author: FIGBERT <figbert@figbert.com>
Date: Thu, 5 Oct 2023 16:15:03 -0700
Give up on semantic style names (for now)
Diffstat:
5 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/article/meta.go b/article/meta.go
@@ -28,8 +28,8 @@ func getReaderModeMetaBlock(title string, url string) string {
return style.Render(
fmt.Sprintf(
"%s\n%s\n%s",
- title, ui.Title().Render(url),
- ui.TagText().Render("Reader Mode"),
+ title, ui.LobstersRed().Render(url),
+ ui.Orange().Render("Reader Mode"),
),
)
}
diff --git a/comments/comments.go b/comments/comments.go
@@ -36,7 +36,7 @@ func Load(post api.Post) tea.Cmd {
headline := fmt.Sprintf(
" %s %s",
ui.Bold().Render(comment.User.Username),
- ui.SecondaryText().Render(humanize.Time(
+ ui.Gray().Render(humanize.Time(
utils.TimeFromAPI(comment.CreatedAt),
)),
)
diff --git a/comments/header.go b/comments/header.go
@@ -33,10 +33,10 @@ func header(post *api.Post) string {
posted := utils.TimeFromAPI(post.CreatedAt)
- user := fmt.Sprintf("by %s %s", ui.Title().Render(post.User.Username), ui.SecondaryText().Render(humanize.Time(posted)))
+ user := fmt.Sprintf("by %s %s", ui.LobstersRed().Render(post.User.Username), ui.Gray().Render(humanize.Time(posted)))
id := fmt.Sprintf("ID %s", gloss.NewStyle().Foreground(gloss.Color("2")).Render(post.ShortID))
cmnts := fmt.Sprintf("%s comments", gloss.NewStyle().Foreground(gloss.Color("5")).Render(fmt.Sprintf("%d", post.CommentCount)))
- karma := fmt.Sprintf("%s karma", ui.TagText().Render(fmt.Sprintf("%d", post.Score)))
+ karma := fmt.Sprintf("%s karma", ui.Orange().Render(fmt.Sprintf("%d", post.Score)))
topSpacer := strings.Repeat(" ", textWidth-gloss.Width(user)-gloss.Width(id))
bottomSpacer := strings.Repeat(" ", textWidth-gloss.Width(cmnts)-gloss.Width(karma))
diff --git a/main.go b/main.go
@@ -88,11 +88,11 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
func (m model) View() string {
var view strings.Builder
- view.WriteString("\n " + ui.Title().Render("Lobsters"))
+ view.WriteString("\n " + ui.LobstersRed().Render("Lobsters"))
padding := m.width - 1 - 8 - len(m.msg) - 1
if padding < 0 {
- errorDot := ui.Title().Render("● ")
+ errorDot := ui.LobstersRed().Render("● ")
padding = m.width - 1 - 8 - 1 - 1
if padding < 0 {
view.WriteString(" " + errorDot)
@@ -100,7 +100,7 @@ func (m model) View() string {
view.WriteString(strings.Repeat(" ", padding) + errorDot)
}
} else {
- view.WriteString(strings.Repeat(" ", padding) + ui.SecondaryText().Render(m.msg) + " ")
+ view.WriteString(strings.Repeat(" ", padding) + ui.Gray().Render(m.msg) + " ")
}
view.WriteString("\n " + ui.HR(m.width-2) + "\n")
diff --git a/ui/styles.go b/ui/styles.go
@@ -2,32 +2,24 @@ package ui
import gloss "github.com/charmbracelet/lipgloss"
-func Title() gloss.Style {
- return gloss.NewStyle().Foreground(LobstersRed())
+func LobstersRed() gloss.Style {
+ return gloss.NewStyle().Foreground(gloss.Color("#AC130D"))
}
-func SecondaryText() gloss.Style {
- return gloss.NewStyle().Foreground(Gray())
+func Gray() gloss.Style {
+ return gloss.NewStyle().Foreground(gloss.Color("8"))
}
-func TagText() gloss.Style {
- return gloss.NewStyle().Foreground(Orange())
+func Orange() gloss.Style {
+ return gloss.NewStyle().Foreground(gloss.Color("#ffc227"))
}
-func Bold() gloss.Style {
- return gloss.NewStyle().Bold(true)
+func Purple() gloss.Style {
+ return gloss.NewStyle().Foreground(gloss.Color("#f0b2b8"))
}
-func LobstersRed() gloss.Color {
- return gloss.Color("#AC130D")
-}
-
-func Gray() gloss.Color {
- return gloss.Color("8")
-}
-
-func Orange() gloss.Color {
- return gloss.Color("#ffc227")
+func Bold() gloss.Style {
+ return gloss.NewStyle().Bold(true)
}
func HR(width int) string {
@@ -35,10 +27,13 @@ func HR(width int) string {
Width(width).
BorderStyle(gloss.NormalBorder()).
BorderTop(true).
- Foreground(Gray()).
+ Foreground(gloss.Color("8")).
Render()
}
func Prompt() gloss.Style {
- return gloss.NewStyle().Foreground(LobstersRed()).Background(gloss.Color("7")).Padding(0, 1)
+ return gloss.NewStyle().
+ Foreground(gloss.Color("#AC130D")).
+ Background(gloss.Color("7")).
+ Padding(0, 1)
}