inputfields.go 687 B

12345678910111213141516171819202122
  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) (messageInputField *tview.InputField) {
  8. messageInputField = tview.NewInputField().
  9. SetPlaceholder("Message...").
  10. SetFieldWidth(0).
  11. SetDoneFunc(onMessageInputFieldDone)
  12. messageInputField.
  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
  19. }