From c119cd9f73b5dd3cbc77b8689a2ded248a9a282c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9E=E3=83=AA=E3=82=A6=E3=82=B9?= Date: Sun, 1 Jan 2023 01:23:46 -0500 Subject: [PATCH] Adjusted colors, improved UI --- config/config.go | 14 +++++++------- ui/views/posts/posts.go | 14 ++++++++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/config/config.go b/config/config.go index 8195a0b..7dba7a4 100644 --- a/config/config.go +++ b/config/config.go @@ -158,7 +158,7 @@ func SetDefaults(cacheDir string) { []bool{true, true, true, true}, ) viper.SetDefault("Theme.PostsList.List.Focused.Border.Foreground", - lipgloss.AdaptiveColor{Light: "#333333", Dark: "#cccccc"}) + lipgloss.AdaptiveColor{Light: "#00ffff", Dark: "#00ffff"}) // PostsList List:Blurred viper.SetDefault("Theme.PostsList.List.Blurred.Margin", @@ -194,21 +194,21 @@ func SetDefaults(cacheDir string) { []bool{false, false, false, true}, ) viper.SetDefault("Theme.PostsList.Item.Selected.Border.Foreground", - lipgloss.AdaptiveColor{Light: "#000000", Dark: "#FFFFFF"}) + lipgloss.AdaptiveColor{Light: "#ffd500", Dark: "#ffd500"}) viper.SetDefault("Theme.PostsList.Item.Selected.Foreground", - lipgloss.AdaptiveColor{Light: "#000000", Dark: "#FFFFFF"}) + lipgloss.AdaptiveColor{Light: "#F25D94", Dark: "#F25D94"}) // PostsList ItemDetail:Focused viper.SetDefault("Theme.PostsList.ItemDetail.Focused.Padding", []int{0, 0, 0, 2}) viper.SetDefault("Theme.PostsList.ItemDetail.Focused.Foreground", - lipgloss.AdaptiveColor{Light: "#333333", Dark: "#cccccc"}) + lipgloss.AdaptiveColor{Light: "#666666", Dark: "#4d4d4d"}) // PostsList ItemDetail:Blurred viper.SetDefault("Theme.PostsList.ItemDetail.Blurred.Padding", []int{0, 0, 0, 2}) viper.SetDefault("Theme.PostsList.ItemDetail.Blurred.Foreground", - lipgloss.AdaptiveColor{Light: "#cccccc", Dark: "#333333"}) + lipgloss.AdaptiveColor{Light: "#666666", Dark: "#4d4d4d"}) // PostsList ItemDetail:Selected viper.SetDefault("Theme.PostsList.ItemDetail.Selected.Padding", @@ -219,7 +219,7 @@ func SetDefaults(cacheDir string) { []bool{false, false, false, true}, ) viper.SetDefault("Theme.PostsList.ItemDetail.Selected.Border.Foreground", - lipgloss.AdaptiveColor{Light: "#000000", Dark: "#FFFFFF"}) + lipgloss.AdaptiveColor{Light: "#ffd500", Dark: "#ffd500"}) viper.SetDefault("Theme.PostsList.ItemDetail.Selected.Foreground", lipgloss.AdaptiveColor{Light: "#000000", Dark: "#FFFFFF"}) @@ -274,5 +274,5 @@ func SetDefaults(cacheDir string) { viper.SetDefault("Theme.Reply.Author.Foreground", lipgloss.AdaptiveColor{Light: "#000000", Dark: "#00000"}) viper.SetDefault("Theme.Reply.Author.Background", - lipgloss.AdaptiveColor{Light: "#5f9ea0", Dark: "#5f9ea0"}) + lipgloss.AdaptiveColor{Light: "#ffd500", Dark: "#ffd500"}) } diff --git a/ui/views/posts/posts.go b/ui/views/posts/posts.go index ff12e72..8163cfd 100644 --- a/ui/views/posts/posts.go +++ b/ui/views/posts/posts.go @@ -301,7 +301,7 @@ func (m *Model) renderViewport(p *post.Post) string { body = p.Body } out += fmt.Sprintf( - " %s\n %s\n%s", + " %s\n\n %s\n%s", m.ctx.Theme.Post.Author.Render( fmt.Sprintf("%s %s:", p.Author.Name, adj), ), @@ -309,7 +309,7 @@ func (m *Model) renderViewport(p *post.Post) string { body, ) - out += m.renderReplies(0, p.Author.Name, &p.Replies) + out += m.renderReplies(0, 1, p.Author.Name, &p.Replies) m.focused = "post" return out @@ -317,6 +317,7 @@ func (m *Model) renderViewport(p *post.Post) string { func (m *Model) renderReplies( level int, + idx int, inReplyTo string, replies *[]reply.Reply, ) string { @@ -344,17 +345,22 @@ func (m *Model) renderReplies( author = re.Author.Name } out += fmt.Sprintf( - "\n\n %s %s\n%s", + "\n\n %s %s%s%s\n%s", m.ctx.Theme.Reply.Author.Render( author, ), lipgloss.NewStyle(). Foreground(m.ctx.Theme.Reply.Author.GetBackground()). Render(fmt.Sprintf("writes in reply to %s:", inReplyTo)), + strings.Repeat(" ", (m.viewport.Width-len(author)-len(inReplyTo)-26)), + lipgloss.NewStyle(). + Foreground(lipgloss.Color("#777777")). + Render(fmt.Sprintf("#%d", idx)), body, ) - out += m.renderReplies(level+1, re.Author.Name, &re.Replies) + idx++ + out += m.renderReplies(level+1, idx, re.Author.Name, &re.Replies) } return out