Skip to content

Commit

Permalink
Colorize repo title and clone command
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Aug 20, 2021
1 parent afb6cf8 commit f779018
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
10 changes: 4 additions & 6 deletions tui/bubbles/repo/bubble.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,18 @@ func (b Bubble) headerView() string {
n = "Home"
}
title := ts.Render(n)
note := ns.Width(b.width - b.widthMargin - lipgloss.Width(title)).
Render(b.sshAddress())
note := ns.Width(b.width - b.widthMargin - lipgloss.Width(title)).Render(b.sshAddress())
return lipgloss.JoinHorizontal(lipgloss.Top, title, note)
}

func (b *Bubble) View() string {
s := b.styles
header := b.headerView()
bs := s.RepoBody.Copy()
bs := b.styles.RepoBody.Copy()
if b.Active {
bs = bs.BorderForeground(s.ActiveBorderColor)
bs = bs.BorderForeground(b.styles.ActiveBorderColor)
}
body := bs.
Width(b.width - b.widthMargin - s.RepoBody.GetVerticalFrameSize()).
Width(b.width - b.widthMargin - b.styles.RepoBody.GetVerticalFrameSize()).
Height(b.height - b.heightMargin - lipgloss.Height(header)).
Render(b.readmeViewport.View())
return header + body
Expand Down
10 changes: 3 additions & 7 deletions tui/style/style.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ type Styles struct {
Error lipgloss.Style
ErrorTitle lipgloss.Style
ErrorBody lipgloss.Style

Command lipgloss.Style
}

func DefaultStyles() *Styles {
Expand Down Expand Up @@ -108,11 +106,13 @@ func DefaultStyles() *Styles {
s.RepoTitle = lipgloss.NewStyle().
Border(s.RepoTitleBorder).
BorderForeground(s.InactiveBorderColor).
Padding(0, 2)
Padding(0, 2).
Foreground(lipgloss.Color("252"))

s.RepoNote = lipgloss.NewStyle().
Border(s.RepoNoteBorder, true, true, true, false).
BorderForeground(s.InactiveBorderColor).
Foreground(lipgloss.Color("168")).
Padding(0, 2)

s.RepoBody = lipgloss.NewStyle().
Expand Down Expand Up @@ -147,9 +147,5 @@ func DefaultStyles() *Styles {
MarginLeft(2).
Width(52) // for now

s.Command = lipgloss.NewStyle().
Background(lipgloss.Color("237")).
Foreground(lipgloss.Color("204"))

return s
}

0 comments on commit f779018

Please sign in to comment.