mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
chore(list): minimal updates for Lip Gloss v2
This commit is contained in:
+15
-11
@@ -32,29 +32,31 @@ type DefaultItemStyles struct {
|
||||
|
||||
// NewDefaultItemStyles returns style definitions for a default item. See
|
||||
// DefaultItemView for when these come into play.
|
||||
func NewDefaultItemStyles() (s DefaultItemStyles) {
|
||||
func NewDefaultItemStyles(isDark bool) (s DefaultItemStyles) {
|
||||
lightDark := lipgloss.LightDark(isDark)
|
||||
|
||||
s.NormalTitle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#1a1a1a", Dark: "#dddddd"}).
|
||||
Foreground(lightDark("#1a1a1a", "#dddddd")).
|
||||
Padding(0, 0, 0, 2) //nolint:mnd
|
||||
|
||||
s.NormalDesc = s.NormalTitle.
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#A49FA5", Dark: "#777777"})
|
||||
Foreground(lightDark("#A49FA5", "#777777"))
|
||||
|
||||
s.SelectedTitle = lipgloss.NewStyle().
|
||||
Border(lipgloss.NormalBorder(), false, false, false, true).
|
||||
BorderForeground(lipgloss.AdaptiveColor{Light: "#F793FF", Dark: "#AD58B4"}).
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#EE6FF8", Dark: "#EE6FF8"}).
|
||||
BorderForeground(lightDark("#F793FF", "#AD58B4")).
|
||||
Foreground(lightDark("#EE6FF8", "#EE6FF8")).
|
||||
Padding(0, 0, 0, 1)
|
||||
|
||||
s.SelectedDesc = s.SelectedTitle.
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#F793FF", Dark: "#AD58B4"})
|
||||
Foreground(lightDark("#F793FF", "#AD58B4"))
|
||||
|
||||
s.DimmedTitle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#A49FA5", Dark: "#777777"}).
|
||||
Foreground(lightDark("#A49FA5", "#777777")).
|
||||
Padding(0, 0, 0, 2) //nolint:mnd
|
||||
|
||||
s.DimmedDesc = s.DimmedTitle.
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#C2B8C2", Dark: "#4D4D4D"})
|
||||
Foreground(lightDark("#C2B8C2", "#4D4D4D"))
|
||||
|
||||
s.FilterMatch = lipgloss.NewStyle().Underline(true)
|
||||
|
||||
@@ -97,9 +99,11 @@ func NewDefaultDelegate() DefaultDelegate {
|
||||
const defaultSpacing = 1
|
||||
return DefaultDelegate{
|
||||
ShowDescription: true,
|
||||
Styles: NewDefaultItemStyles(),
|
||||
height: defaultHeight,
|
||||
spacing: defaultSpacing,
|
||||
// XXX: Let the user choose between light and dark colors. We've
|
||||
// temporarily hardcoded the dark colors here.
|
||||
Styles: NewDefaultItemStyles(true),
|
||||
height: defaultHeight,
|
||||
spacing: defaultSpacing,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -197,7 +197,9 @@ type Model struct {
|
||||
|
||||
// New returns a new model with sensible defaults.
|
||||
func New(items []Item, delegate ItemDelegate, width, height int) Model {
|
||||
styles := DefaultStyles()
|
||||
// XXX: Let the user choose between light and dark colors. We've
|
||||
// temporarily hardcoded the dark colors here.
|
||||
styles := DefaultStyles(true)
|
||||
|
||||
sp := spinner.New()
|
||||
sp.Spinner = spinner.Line
|
||||
|
||||
+12
-10
@@ -41,9 +41,11 @@ type Styles struct {
|
||||
|
||||
// DefaultStyles returns a set of default style definitions for this list
|
||||
// component.
|
||||
func DefaultStyles() (s Styles) {
|
||||
verySubduedColor := lipgloss.AdaptiveColor{Light: "#DDDADA", Dark: "#3C3C3C"}
|
||||
subduedColor := lipgloss.AdaptiveColor{Light: "#9B9B9B", Dark: "#5C5C5C"}
|
||||
func DefaultStyles(isDark bool) (s Styles) {
|
||||
lightDark := lipgloss.LightDark(isDark)
|
||||
|
||||
verySubduedColor := lightDark("#DDDADA", "#3C3C3C")
|
||||
subduedColor := lightDark("#9B9B9B", "#5C5C5C")
|
||||
|
||||
s.TitleBar = lipgloss.NewStyle().Padding(0, 0, 1, 2) //nolint:mnd
|
||||
|
||||
@@ -53,29 +55,29 @@ func DefaultStyles() (s Styles) {
|
||||
Padding(0, 1)
|
||||
|
||||
s.Spinner = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#8E8E8E", Dark: "#747373"})
|
||||
Foreground(lightDark("#8E8E8E", "#747373"))
|
||||
|
||||
s.FilterPrompt = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#04B575", Dark: "#ECFD65"})
|
||||
Foreground(lightDark("#04B575", "#ECFD65"))
|
||||
|
||||
s.FilterCursor = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#EE6FF8", Dark: "#EE6FF8"})
|
||||
Foreground(lightDark("#EE6FF8", "#EE6FF8"))
|
||||
|
||||
s.DefaultFilterCharacterMatch = lipgloss.NewStyle().Underline(true)
|
||||
|
||||
s.StatusBar = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#A49FA5", Dark: "#777777"}).
|
||||
Foreground(lightDark("#A49FA5", "#777777")).
|
||||
Padding(0, 0, 1, 2) //nolint:mnd
|
||||
|
||||
s.StatusEmpty = lipgloss.NewStyle().Foreground(subduedColor)
|
||||
|
||||
s.StatusBarActiveFilter = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#1a1a1a", Dark: "#dddddd"})
|
||||
Foreground(lightDark("#1a1a1a", "#dddddd"))
|
||||
|
||||
s.StatusBarFilterCount = lipgloss.NewStyle().Foreground(verySubduedColor)
|
||||
|
||||
s.NoItems = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#909090", Dark: "#626262"})
|
||||
Foreground(lightDark("#909090", "#626262"))
|
||||
|
||||
s.ArabicPagination = lipgloss.NewStyle().Foreground(subduedColor)
|
||||
|
||||
@@ -84,7 +86,7 @@ func DefaultStyles() (s Styles) {
|
||||
s.HelpStyle = lipgloss.NewStyle().Padding(1, 0, 0, 2) //nolint:mnd
|
||||
|
||||
s.ActivePaginationDot = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#847A85", Dark: "#979797"}).
|
||||
Foreground(lightDark("#847A85", "#979797")).
|
||||
SetString(bullet)
|
||||
|
||||
s.InactivePaginationDot = lipgloss.NewStyle().
|
||||
|
||||
Reference in New Issue
Block a user