inputfields.go 687 B

1234567891011121314151617181920212223
  1. package ui
  2. import (
  3. "github.com/gdamore/tcell/v2"
  4. "github.com/rigormorrtiss/discordo/util"
  5. "github.com/rivo/tview"
  6. )
  7. func NewMessageInputField(onMessageInputFieldDone func(key tcell.Key), theme *util.Theme) *tview.InputField {
  8. messageInputField := tview.NewInputField()
  9. messageInputField.
  10. SetPlaceholder("Message...").
  11. SetFieldWidth(0).
  12. SetDoneFunc(onMessageInputFieldDone).
  13. SetFieldBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
  14. SetPlaceholderTextColor(tcell.GetColor(theme.InputFieldPlaceholderForeground)).
  15. SetBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
  16. SetBorder(true).
  17. SetBorderPadding(0, 0, 1, 1)
  18. return messageInputField
  19. }