From 2e91d69ffb5989a167821979d4ed8d71a0f6ecbe Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Thu, 23 Jul 2026 14:03:04 +0200 Subject: tui: colored reader + version switch --- internal/tui/styles.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 internal/tui/styles.go (limited to 'internal/tui/styles.go') diff --git a/internal/tui/styles.go b/internal/tui/styles.go new file mode 100644 index 0000000..94b591e --- /dev/null +++ b/internal/tui/styles.go @@ -0,0 +1,44 @@ +package tui + +import "github.com/charmbracelet/lipgloss" + +// Color roles for the reader. lipgloss.AdaptiveColor picks the Light or Dark +// value based on the terminal's detected background, and the default +// renderer's color profile already honors NO_COLOR (muesli/termenv's +// EnvColorProfile falls back to Ascii, so styled text degrades to plain +// text automatically -- no extra handling needed here). +var ( + accentColor = lipgloss.AdaptiveColor{Light: "#8839ef", Dark: "#cba6f7"} // heading + dimColor = lipgloss.AdaptiveColor{Light: "#6c6f85", Dark: "#a6adc8"} // citation + mutedColor = lipgloss.AdaptiveColor{Light: "#9ca0b0", Dark: "#6c7086"} // verse numbers + textColor = lipgloss.AdaptiveColor{Light: "#4c4f69", Dark: "#cdd6f4"} // verse text (default) + barColor = lipgloss.AdaptiveColor{Light: "#eff1f5", Dark: "#313244"} // header/footer background + barTextColor = lipgloss.AdaptiveColor{Light: "#4c4f69", Dark: "#cdd6f4"} + errColor = lipgloss.AdaptiveColor{Light: "#d20f39", Dark: "#f38ba8"} +) + +var ( + // headingStyle renders a reading section's heading (e.g. "Ewangelia"). + headingStyle = lipgloss.NewStyle().Bold(true).Foreground(accentColor) + + // citationStyle renders a section's subtitle/citation line. + citationStyle = lipgloss.NewStyle().Faint(true).Foreground(dimColor) + + // verseNumStyle renders a bible verse's "chapter:verse" prefix. + verseNumStyle = lipgloss.NewStyle().Foreground(mutedColor) + + // verseTextStyle renders verse/paragraph body text. + verseTextStyle = lipgloss.NewStyle().Foreground(textColor) + + // refrainStyle renders a responsorial psalm's repeated refrain. + refrainStyle = lipgloss.NewStyle().Italic(true).Foreground(textColor) + + // headerStyle renders the top bar (date + active version). + headerStyle = lipgloss.NewStyle().Bold(true).Foreground(barTextColor).Background(barColor).Padding(0, 1) + + // footerStyle renders the bottom keybar. + footerStyle = lipgloss.NewStyle().Faint(true).Foreground(barTextColor).Background(barColor).Padding(0, 1) + + // errStyle renders the error line. + errStyle = lipgloss.NewStyle().Bold(true).Foreground(errColor) +) -- cgit v1.3