textviews.go 628 B

123456789101112131415161718192021222324
  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 NewMessagesTextView(onMessagesTextViewChanged func(), theme *util.Theme) (messagesTextView *tview.TextView) {
  8. messagesTextView = tview.NewTextView().
  9. SetDynamicColors(true).
  10. SetWrap(true).
  11. SetWordWrap(true).
  12. SetScrollable(true).
  13. ScrollToEnd().
  14. SetChangedFunc(onMessagesTextViewChanged)
  15. messagesTextView.
  16. SetTextColor(tcell.GetColor(theme.TextViewForeground)).
  17. SetBackgroundColor(tcell.GetColor(theme.TextViewBackground)).
  18. SetBorder(true).
  19. SetBorderPadding(0, 0, 1, 1)
  20. return
  21. }