Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow theme to be set only once #123

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions field_confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ func (c *Confirm) String() string {

// WithTheme sets the theme of the confirm field.
func (c *Confirm) WithTheme(theme *Theme) Field {
if c.theme != nil {
return c
}
c.theme = theme
return c
}
Expand Down
3 changes: 3 additions & 0 deletions field_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ func (i *Input) WithAccessible(accessible bool) Field {

// WithTheme sets the theme of the input field.
func (i *Input) WithTheme(theme *Theme) Field {
if i.theme != nil {
return i
}
i.theme = theme
return i
}
Expand Down
3 changes: 3 additions & 0 deletions field_multiselect.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ func (m *MultiSelect[T]) runAccessible() error {

// WithTheme sets the theme of the multi-select field.
func (m *MultiSelect[T]) WithTheme(theme *Theme) Field {
if m.theme != nil {
return m
}
m.theme = theme
m.filter.Cursor.Style = m.theme.Focused.TextInput.Cursor
m.filter.PromptStyle = m.theme.Focused.TextInput.Prompt
Expand Down
3 changes: 3 additions & 0 deletions field_note.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func (n *Note) runAccessible() error {

// WithTheme sets the theme on a note field.
func (n *Note) WithTheme(theme *Theme) Field {
if n.theme != nil {
return n
}
n.theme = theme
return n
}
Expand Down
3 changes: 3 additions & 0 deletions field_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ func (s *Select[T]) runAccessible() error {

// WithTheme sets the theme of the select field.
func (s *Select[T]) WithTheme(theme *Theme) Field {
if s.theme != nil {
return s
}
s.theme = theme
s.filter.Cursor.Style = s.theme.Focused.TextInput.Cursor
s.filter.PromptStyle = s.theme.Focused.TextInput.Prompt
Expand Down
3 changes: 3 additions & 0 deletions field_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ func (t *Text) runAccessible() error {

// WithTheme sets the theme on a text field.
func (t *Text) WithTheme(theme *Theme) Field {
if t.theme != nil {
return t
}
t.theme = theme
return t
}
Expand Down
Loading