Files
HostKeeper/pkg/tui/styles.go
T
swanadiva 5d9e38f8db feat: Task 15 — TUI Tab Framework + Orange Theme
- pkg/tui/styles.go — orange theme palette and component styles
- pkg/tui/tabs.go — Tab interface + TabManager with add/close/next/prev
- pkg/tui/host_list_tab.go — HostListTab implementing Tab interface
- pkg/tui/tui.go — refactored to use TabManager (backward compatible)
- pkg/tui/host_list.go — removed (logic moved to host_list_tab.go)
- pkg/tui/tui_test.go — adapted + added TabManager tests
2026-06-23 14:51:13 +07:00

45 lines
1.8 KiB
Go

package tui
import "github.com/charmbracelet/lipgloss"
// Orange theme palette
var (
OrangePrimary = lipgloss.Color("#FF6B00")
OrangeSecondary = lipgloss.Color("#FF9F43")
OrangeLight = lipgloss.Color("#FFB800")
DarkBg = lipgloss.Color("#1A1A1A")
LightBg = lipgloss.Color("#2D2D2D")
TextPrimary = lipgloss.Color("#FFFFFF")
TextSecondary = lipgloss.Color("#AAAAAA")
GreenSuccess = lipgloss.Color("#00FF88")
RedError = lipgloss.Color("#FF4444")
BlueInfo = lipgloss.Color("#44AAFF")
)
// Component styles
var (
TabActiveStyle = lipgloss.NewStyle().Background(OrangePrimary).Foreground(DarkBg).Bold(true).Padding(0, 2)
TabInactiveStyle = lipgloss.NewStyle().Background(LightBg).Foreground(TextSecondary).Padding(0, 2)
TabBarStyle = lipgloss.NewStyle().Background(DarkBg)
StatusBarStyle = lipgloss.NewStyle().Background(OrangePrimary).Foreground(DarkBg).Padding(0, 1)
AppTitleStyle = lipgloss.NewStyle().Foreground(OrangeSecondary).Bold(true)
HighlightStyle = lipgloss.NewStyle().Foreground(OrangePrimary).Bold(true)
SelectedStyle = lipgloss.NewStyle().Foreground(DarkBg).Background(OrangePrimary).Padding(0, 1)
ErrorStyle = lipgloss.NewStyle().Foreground(RedError).Bold(true)
SuccessStyle = lipgloss.NewStyle().Foreground(GreenSuccess).Bold(true)
InfoStyle = lipgloss.NewStyle().Foreground(BlueInfo)
SubtitleStyle = lipgloss.NewStyle().Foreground(TextSecondary)
HostNameStyle = lipgloss.NewStyle().Foreground(OrangeLight).Bold(true)
HostDetailStyle = lipgloss.NewStyle().Foreground(TextSecondary)
TagStyle = lipgloss.NewStyle().Foreground(GreenSuccess)
TitleStyle = AppTitleStyle
)
// TabWidth returns the width of the tab bar content
func TabBarWidth(totalWidth int) int {
if totalWidth < 10 {
return totalWidth
}
return totalWidth - 2
}