inputfields.go 758 B

1234567891011121314151617181920212223
  1. package ui
  2. import (
  3. "github.com/diamondburned/arikawa/v3/discord"
  4. "github.com/diamondburned/arikawa/v3/session"
  5. "github.com/gdamore/tcell/v2"
  6. "github.com/rigormorrtiss/discordo/util"
  7. "github.com/rivo/tview"
  8. )
  9. func NewMessageInputField(onMessageInputFieldInputCapture func(event *tcell.EventKey) *tcell.EventKey, s *session.Session, c discord.Channel, theme *util.Theme) *tview.InputField {
  10. i := tview.NewInputField()
  11. i.
  12. SetPlaceholder("Message...").
  13. SetPlaceholderTextColor(tcell.ColorWhite).
  14. SetFieldBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
  15. SetBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
  16. SetBorder(true).
  17. SetBorderPadding(0, 0, 1, 1).
  18. SetInputCapture(onMessageInputFieldInputCapture)
  19. return i
  20. }