mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
feat: add a Styler interface for styling bubbles
This change introduces a Styler interface that allows users to define custom styles for bubbles. The interface is implemented by the StylerFunc type, which is a function type that takes a boolean argument and returns a value of any type. This allows a user to define a custom StylerFunc that returns a custom style for a bubble based on the background color of the terminal.
This commit is contained in:
@@ -283,12 +283,12 @@ type Model struct {
|
||||
}
|
||||
|
||||
// New creates a new model with default settings.
|
||||
func New() Model {
|
||||
func New(isDark bool) Model {
|
||||
vp := viewport.New(0, 0)
|
||||
vp.KeyMap = viewport.KeyMap{}
|
||||
cur := cursor.New()
|
||||
|
||||
styles := DefaultStyles(true)
|
||||
styles := DefaultStyles(isDark)
|
||||
|
||||
m := Model{
|
||||
CharLimit: defaultCharLimit,
|
||||
|
||||
@@ -1703,7 +1703,7 @@ func TestView(t *testing.T) {
|
||||
}
|
||||
|
||||
func newTextArea() Model {
|
||||
textarea := New()
|
||||
textarea := New(true)
|
||||
|
||||
textarea.Prompt = "> "
|
||||
textarea.Placeholder = "Hello, World!"
|
||||
|
||||
Reference in New Issue
Block a user