Bold alone was hard to see without a theme, so the other panes didn't show what was selected in them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
79 lines
2.9 KiB
Go
79 lines
2.9 KiB
Go
// Package styles holds the lipgloss theme. It sticks to the 16 ANSI colours
|
|
// so it follows the user's terminal palette in both light and dark themes.
|
|
package styles
|
|
|
|
import (
|
|
"charm.land/lipgloss/v2"
|
|
|
|
"git.kebcloud.no/keb/lazysecrets/internal/provider"
|
|
)
|
|
|
|
type Styles struct {
|
|
BorderFocused lipgloss.Style
|
|
BorderBlurred lipgloss.Style
|
|
TitleFocused lipgloss.Style
|
|
TitleBlurred lipgloss.Style
|
|
Footer lipgloss.Style
|
|
|
|
Selected lipgloss.Style // cursor row in the focused pane
|
|
SelectedBlurred lipgloss.Style // cursor row in other panes
|
|
Muted lipgloss.Style
|
|
Error lipgloss.Style
|
|
Notice lipgloss.Style
|
|
Success lipgloss.Style // the ✓ before confirmations
|
|
Warning lipgloss.Style // "can't do that here" messages
|
|
Match lipgloss.Style // filter matches
|
|
Favourite lipgloss.Style
|
|
Prompt lipgloss.Style // questions in the footer
|
|
Label lipgloss.Style
|
|
Masked lipgloss.Style
|
|
Value lipgloss.Style
|
|
|
|
KindAzure lipgloss.Style
|
|
KindDatabricks lipgloss.Style
|
|
KindRepo lipgloss.Style
|
|
}
|
|
|
|
func Default() Styles {
|
|
green := lipgloss.Green
|
|
return Styles{
|
|
BorderFocused: lipgloss.NewStyle().Foreground(green),
|
|
BorderBlurred: lipgloss.NewStyle().Faint(true),
|
|
TitleFocused: lipgloss.NewStyle().Foreground(green).Bold(true),
|
|
TitleBlurred: lipgloss.NewStyle(),
|
|
Footer: lipgloss.NewStyle().Faint(true),
|
|
|
|
// A background rather than reverse, so the row keeps its colours;
|
|
// in every pane, so each shows what's selected in it. The focused
|
|
// pane's is bold too.
|
|
Selected: lipgloss.NewStyle().Background(lipgloss.BrightBlack).Bold(true),
|
|
SelectedBlurred: lipgloss.NewStyle().Background(lipgloss.BrightBlack),
|
|
Muted: lipgloss.NewStyle().Faint(true),
|
|
Error: lipgloss.NewStyle().Foreground(lipgloss.Red),
|
|
Notice: lipgloss.NewStyle().Foreground(lipgloss.Green),
|
|
Success: lipgloss.NewStyle().Foreground(lipgloss.Green).Bold(true),
|
|
Warning: lipgloss.NewStyle().Foreground(lipgloss.Yellow),
|
|
Match: lipgloss.NewStyle().Foreground(lipgloss.Yellow).Bold(true),
|
|
Favourite: lipgloss.NewStyle().Foreground(lipgloss.Yellow),
|
|
Prompt: lipgloss.NewStyle().Foreground(lipgloss.Yellow).Bold(true),
|
|
Label: lipgloss.NewStyle().Foreground(lipgloss.Blue).Bold(true),
|
|
Masked: lipgloss.NewStyle().Faint(true),
|
|
Value: lipgloss.NewStyle().Foreground(lipgloss.Yellow),
|
|
|
|
KindAzure: lipgloss.NewStyle().Foreground(lipgloss.Blue),
|
|
KindDatabricks: lipgloss.NewStyle().Foreground(lipgloss.Red),
|
|
KindRepo: lipgloss.NewStyle().Foreground(lipgloss.Magenta),
|
|
}
|
|
}
|
|
|
|
// Kind is the colour of a provider's sources, vaults and paths.
|
|
func (s Styles) Kind(k provider.Kind) lipgloss.Style {
|
|
switch k {
|
|
case provider.KindDatabricks:
|
|
return s.KindDatabricks
|
|
case provider.KindRepo:
|
|
return s.KindRepo
|
|
}
|
|
return s.KindAzure
|
|
}
|