Skip to content

Commit

Permalink
refactor: clean up Theme
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Jan 7, 2025
1 parent d5b26eb commit 152f09d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 28 deletions.
7 changes: 3 additions & 4 deletions field_confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,10 @@ func (c *Confirm) activeStyles() *FieldStyles {

// Theme returns the theme of the field.
func (c *Confirm) Theme() *Theme {
theme := c.theme
if theme == nil {
theme = ThemeCharm()
if c.theme != nil {
return c.theme
}
return theme
return ThemeCharm()
}

// View renders the confirm field.
Expand Down
7 changes: 3 additions & 4 deletions field_filepicker.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,10 @@ func (f *FilePicker) activeStyles() *FieldStyles {

// Theme returns the theme of the field.
func (f *FilePicker) Theme() *Theme {
theme := f.theme
if theme == nil {
theme = ThemeCharm()
if f.theme != nil {
return f.theme
}
return theme
return ThemeCharm()
}

// View renders the file field.
Expand Down
7 changes: 3 additions & 4 deletions field_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,10 @@ func (i *Input) activeStyles() *FieldStyles {

// Theme returns the theme of the field.
func (i *Input) Theme() *Theme {
theme := i.theme
if theme == nil {
theme = ThemeCharm()
if i.theme != nil {
return i.theme
}
return theme
return ThemeCharm()
}

// View renders the input field.
Expand Down
7 changes: 3 additions & 4 deletions field_multiselect.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,10 @@ func (m *MultiSelect[T]) activeStyles() *FieldStyles {

// Theme returns the theme of the field.
func (m *MultiSelect[T]) Theme() *Theme {
theme := m.theme
if theme == nil {
theme = ThemeCharm()
if m.theme != nil {
return m.theme
}
return theme
return ThemeCharm()
}

func (m *MultiSelect[T]) titleView() string {
Expand Down
7 changes: 3 additions & 4 deletions field_note.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,10 @@ func (n *Note) activeStyles() *FieldStyles {

// Theme returns the theme of the field.
func (n *Note) Theme() *Theme {
theme := n.theme
if theme == nil {
theme = ThemeCharm()
if n.theme != nil {
return n.theme
}
return theme
return ThemeCharm()
}

// View renders the note field.
Expand Down
7 changes: 3 additions & 4 deletions field_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,10 @@ func (s *Select[T]) activeStyles() *FieldStyles {

// Theme returns the theme of the field.
func (s *Select[T]) Theme() *Theme {
theme := s.theme
if theme == nil {
theme = ThemeCharm()
if s.theme != nil {
return s.theme
}
return theme
return ThemeCharm()
}

func (s *Select[T]) titleView() string {
Expand Down
7 changes: 3 additions & 4 deletions field_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,10 @@ func (t *Text) activeStyles() *FieldStyles {

// Theme returns the theme of the field.
func (t *Text) Theme() *Theme {
theme := t.theme
if theme == nil {
theme = ThemeCharm()
if t.theme != nil {
return t.theme
}
return theme
return ThemeCharm()
}

func (t *Text) activeTextAreaStyles() *textarea.Style {
Expand Down

0 comments on commit 152f09d

Please sign in to comment.