diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2024-11-25 22:32:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-25 22:32:32 -0500 |
commit | bacb927e5f001f4186abb94259d752d8a4c1d8e6 (patch) | |
tree | d937f7e19470f75996bab2f0d39f341ed7662dce /internal | |
parent | 0695ea52f11e57cb7bcb3f770c9404f0fb6b8d15 (diff) |
underline+bold+bright to indicate active tab (#17)
Diffstat (limited to 'internal')
-rw-r--r-- | internal/switcher/switcher.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/internal/switcher/switcher.go b/internal/switcher/switcher.go index 74f0d6b..f368224 100644 --- a/internal/switcher/switcher.go +++ b/internal/switcher/switcher.go @@ -3,6 +3,7 @@ package switcher import ( "fmt" "log/slog" + "strings" "github.com/ChausseBenjamin/termpicker/internal/colors" "github.com/ChausseBenjamin/termpicker/internal/notices" @@ -92,14 +93,29 @@ func (m Model) Init() tea.Cmd { } func (m Model) View() string { - tabs := "|" + norm := lipgloss.NewStyle().Faint(true) + bright := lipgloss.NewStyle().Faint(false) + + delims := [3]string{"[ ", " | ", "]"} + for i, d := range delims { + delims[i] = bright.Render(d) + } + + var sections []string for i, p := range m.pickers { if i == m.active { - tabs += fmt.Sprintf(">%s<|", p.Title()) + sections = append( + sections, + bright. + Underline(true). + Bold(true). + Render(p.Title()), + ) } else { - tabs += fmt.Sprintf(" %s |", p.Title()) + sections = append(sections, norm.Render(p.Title())) } } + tabs := "[ " + strings.Join(sections, " | ") + " ]" pickerView := m.pickers[m.active].View() boxStyle := lipgloss.NewStyle().Border(lipgloss.RoundedBorder(), true, true, false, true) |