From a0e83b8044a757a16d74bb1adb957928c924a67e Mon Sep 17 00:00:00 2001 From: Ryan Melendez Date: Fri, 8 Dec 2023 10:59:39 -0500 Subject: [PATCH 1/2] Add content style for controlling colors --- viewport/viewport.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/viewport/viewport.go b/viewport/viewport.go index b13e33c0..4a558dac 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -42,6 +42,10 @@ type Model struct { // useful for setting borders, margins and padding. Style lipgloss.Style + // Style applies a lipgloss style to the content in the viewport. + // Can be be helpful for controlling the background and foreground colors. + ContentStyle lipgloss.Style + // HighPerformanceRendering bypasses the normal Bubble Tea renderer to // provide higher performance rendering. Most of the time the normal Bubble // Tea rendering methods will suffice, but if you're passing content with @@ -372,7 +376,7 @@ func (m Model) View() string { } contentWidth := w - m.Style.GetHorizontalFrameSize() contentHeight := h - m.Style.GetVerticalFrameSize() - contents := lipgloss.NewStyle(). + contents := m.ContentStyle.Copy(). Height(contentHeight). // pad to height. MaxHeight(contentHeight). // truncate height if taller. MaxWidth(contentWidth). // truncate width. From b4c366ceab6fdee46648f68f4c9b7988040d44a9 Mon Sep 17 00:00:00 2001 From: Ryan Melendez Date: Fri, 8 Dec 2023 11:08:45 -0500 Subject: [PATCH 2/2] Fix typo --- viewport/viewport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viewport/viewport.go b/viewport/viewport.go index 4a558dac..603767e1 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -43,7 +43,7 @@ type Model struct { Style lipgloss.Style // Style applies a lipgloss style to the content in the viewport. - // Can be be helpful for controlling the background and foreground colors. + // Can be helpful for controlling the background and foreground colors. ContentStyle lipgloss.Style // HighPerformanceRendering bypasses the normal Bubble Tea renderer to