inputfields.go 620 B

123456789101112131415161718192021
  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(onMessageInputFieldInputCapture func(*tcell.EventKey) *tcell.EventKey, theme *util.Theme) (i *tview.InputField) {
  8. i = tview.NewInputField()
  9. i.
  10. SetPlaceholder("Message...").
  11. SetPlaceholderTextColor(tcell.ColorWhite).
  12. SetFieldBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
  13. SetBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
  14. SetBorder(true).
  15. SetBorderPadding(0, 0, 1, 1).
  16. SetInputCapture(onMessageInputFieldInputCapture)
  17. return
  18. }