Text highlighting, not pink, its salmon obviously.

This commit is contained in:
Salastil
2025-10-20 14:08:00 -04:00
parent 52a1855b2d
commit 271f2c2e7d

View File

@@ -20,15 +20,17 @@ type Styles struct {
} }
func NewStyles() Styles { func NewStyles() Styles {
border := lipgloss.RoundedBorder() border := lipgloss.RoundedBorder()
return Styles{ return Styles{
Title: lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("12")), Title: lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("12")),
// REMOVE MarginRight(1) from both Box and Active: Box: lipgloss.NewStyle().Border(border).Padding(0, 1).MarginRight(1),
Box: lipgloss.NewStyle().Border(border).Padding(0, 1), Active: lipgloss.NewStyle().
Active: lipgloss.NewStyle().Border(border).BorderForeground(lipgloss.Color("10")).Padding(0, 1), Border(border).
Status: lipgloss.NewStyle().Foreground(lipgloss.Color("8")).MarginTop(1), BorderForeground(lipgloss.Color("#FA8072")). // Not pink, its Salmon obviously
Error: lipgloss.NewStyle().Foreground(lipgloss.Color("9")).Bold(true), Padding(0, 1).
} MarginRight(1),
Status: lipgloss.NewStyle().Foreground(lipgloss.Color("8")).MarginTop(1),
}
} }
// ──────────────────────────────── // ────────────────────────────────
@@ -114,17 +116,22 @@ func (c *ListColumn[T]) View(styles Styles, focused bool) string {
if end > len(c.items) { if end > len(c.items) {
end = len(c.items) end = len(c.items)
} }
for i := start; i < end; i++ { for i := start; i < end; i++ {
cursor := " " cursor := " "
if i == c.selected { lineText := c.render(c.items[i])
cursor = "▸ " if i == c.selected {
} cursor = "▸ "
line := fmt.Sprintf("%s%s", cursor, c.render(c.items[i])) lineText = lipgloss.NewStyle().
if len(line) > c.width && c.width > 3 { Foreground(lipgloss.Color("#FA8072")). // Not pink, its Salmon obviously
line = line[:c.width-3] + "…" Bold(true).
} Render(lineText)
lines = append(lines, line)
} }
line := fmt.Sprintf("%s%s", cursor, lineText)
if len(line) > c.width && c.width > 3 {
line = line[:c.width-3] + "…"
}
lines = append(lines, line)
}
} }
// Fill remaining lines if fewer than height // Fill remaining lines if fewer than height