Files
swanadiva 53db03814e feat: centered card-style host list layout
- Each host rendered as a bordered card (HostCardStyle / HostCardActiveStyle)
- Title centered horizontally
- Content constrained to 80 columns max
- Vertical centering padding
- Selected host card gets green border (gbGreen #a9b665)
- Empty state message centered
- Removed old plain-text renderHost/renderSelectedHost functions
2026-06-23 15:42:03 +07:00

60 lines
2.7 KiB
Go

package tui
import "github.com/charmbracelet/lipgloss"
// Gruvbox Material Dark Hard palette — warm, soft, easy on eyes
var (
gbFg = lipgloss.Color("#d4be98") // primary text
gbFgMute = lipgloss.Color("#7c6f64") // secondary/hints
gbBgSel = lipgloss.Color("#45403d") // cursor row bg
gbRed = lipgloss.Color("#ea6962") // error/destructive
gbOrange = lipgloss.Color("#e78a4e") // section headers
gbYellow = lipgloss.Color("#d8a657") // accent/titles
gbGreen = lipgloss.Color("#a9b665") // active pane/success
gbAqua = lipgloss.Color("#89b482") // interactive keys
gbBlue = lipgloss.Color("#7daea3")
gbPurple = lipgloss.Color("#d3869b")
gbBorder = lipgloss.Color("#504945") // subtle border
)
// Component styles
var (
TabActiveStyle = lipgloss.NewStyle().Background(gbYellow).Foreground(lipgloss.Color("#1d2021")).Bold(true).Padding(0, 2)
TabInactiveStyle = lipgloss.NewStyle().Background(gbBorder).Foreground(gbFgMute).Padding(0, 2)
TabBarStyle = lipgloss.NewStyle().Background(lipgloss.Color("#1d2021"))
StatusBarStyle = lipgloss.NewStyle().Background(gbGreen).Foreground(lipgloss.Color("#1d2021")).Padding(0, 1)
AppTitleStyle = lipgloss.NewStyle().Foreground(gbYellow).Bold(true)
HighlightStyle = lipgloss.NewStyle().Foreground(gbOrange).Bold(true)
SelectedStyle = lipgloss.NewStyle().Foreground(gbFg).Background(gbBgSel).Bold(true).Padding(0, 1)
ErrorStyle = lipgloss.NewStyle().Foreground(gbRed).Bold(true)
SuccessStyle = lipgloss.NewStyle().Foreground(gbGreen).Bold(true)
InfoStyle = lipgloss.NewStyle().Foreground(gbAqua)
SubtitleStyle = lipgloss.NewStyle().Foreground(gbFgMute)
HostNameStyle = lipgloss.NewStyle().Foreground(gbYellow).Bold(true)
HostDetailStyle = lipgloss.NewStyle().Foreground(gbFgMute)
TagStyle = lipgloss.NewStyle().Foreground(gbGreen)
TitleStyle = AppTitleStyle
SectionStyle = lipgloss.NewStyle().Foreground(gbOrange).Bold(true)
BorderStyle = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(gbBorder).Padding(1, 2)
)
// TabWidth returns the width of the tab bar content
func TabBarWidth(totalWidth int) int {
if totalWidth < 10 {
return totalWidth
}
return totalWidth - 2
}
// Pane styles for dual-pane layout
var (
StylePaneActive = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(gbGreen).Padding(0, 1)
StylePaneInactive = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(gbBorder).Padding(0, 1)
)
// Host card styles
var (
HostCardStyle = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(gbBorder).Padding(0, 1)
HostCardActiveStyle = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(gbGreen).Padding(0, 1)
)