Documentation ¶
Index ¶
- Constants
- Variables
- func ColorProfile() termenv.Profile
- func Frame(fps float64) tea.Cmd
- func NewOutput(w io.Writer, opts ...termenv.OutputOption) *termenv.Output
- type FrameMsg
- type KeyMap
- type Rave
- func (m *Rave) Desync() tea.Cmd
- func (rave *Rave) Init() tea.Cmd
- func (sched *Rave) Progress(now time.Time) (int, float64)
- func (rave *Rave) SpotifyCallbackURL() string
- func (m *Rave) Sync() tea.Cmd
- func (rave *Rave) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (rave *Rave) View() string
- func (rave *Rave) ViewFancy() string
- func (rave *Rave) ViewFrame(frames SpinnerFrames) (string, time.Time, int)
- type SetFPSMsg
- type Spinner
- type SpinnerFrames
- type Vterm
- func (term *Vterm) Bytes(offset, height int) []byte
- func (term *Vterm) Init() tea.Cmd
- func (term *Vterm) LastLine() string
- func (term *Vterm) Print(w io.Writer) error
- func (term *Vterm) ScrollPercent() float64
- func (term *Vterm) SetHeight(height int)
- func (term *Vterm) SetPrefix(prefix string)
- func (term *Vterm) SetWidth(width int)
- func (term *Vterm) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (term *Vterm) UsedHeight() int
- func (term *Vterm) View() string
- func (term *Vterm) Write(p []byte) (int, error)
Constants ¶
const DefaultBPM = 123
DefaultBPM is a sane default of 123 beats per minute.
Variables ¶
var DotFrames = SpinnerFrames{ []string{"⣾", "⣷", "⣧", "⣏", "⡟", "⡿", "⢿", "⢻", "⣹", "⣼"}, ease.Linear, }
var FadeFrames = SpinnerFrames{ []string{"█", "█", "▓", "▓", "▒", "▒", "░", "░", " ", " "}, ease.InOutCubic, }
var Keys = KeyMap{ Help: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "help"), ), Quit: key.NewBinding( key.WithKeys("q", "esc", "ctrl+c"), key.WithHelp("q", "quit"), ), Debug: key.NewBinding( key.WithKeys("d"), key.WithHelp("d", "debug ui"), ), Rave: key.NewBinding( key.WithKeys("r"), key.WithHelp("r", "rave"), ), EndRave: key.NewBinding( key.WithKeys("R"), key.WithHelp("R", "end rave"), ), ForwardRave: key.NewBinding( key.WithKeys("+", "="), key.WithHelp("+/=", "seek forward"), ), BackwardRave: key.NewBinding( key.WithKeys("-"), key.WithHelp("-", "seek backward"), ), Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "move up"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "move down"), ), Home: key.NewBinding( key.WithKeys("home"), key.WithHelp("home", "go to top"), ), End: key.NewBinding( key.WithKeys("end"), key.WithHelp("end", "go to bottom"), ), PageDown: key.NewBinding( key.WithKeys("pgdown"), key.WithHelp("pgdn", "page down"), ), PageUp: key.NewBinding( key.WithKeys("pgup"), key.WithHelp("pgup", "page up"), ), }
var MeterFrames = SpinnerFrames{ []string{"█", "█", "▇", "▆", "▅", "▄", "▃", "▂", "▁", " "}, ease.InOutCubic, }
var MiniDotFrames = SpinnerFrames{ []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}, ease.Linear, }
Functions ¶
func ColorProfile ¶ added in v0.10.1
ColorProfile returns Ascii if, and only if, NO_COLOR or similar is set. Otherwise it returns termenv.ANSI, allowing colors to be used.
Note that color profiles beyond simple ANSI are not used by Progrock. 16 colors is all you need. Anything else disrespects the user's color scheme preferences.
func NewOutput ¶ added in v0.10.1
NewOutput returns a termenv.Output that will always use color, regardless of whether w is a TTY, unless NO_COLOR is explicitly set.
Progrock is opinionated here. Termenv disables colors by default if stdout is not a TTY or if the CI env var is set. We don't want that, because folks deserve colorful output in CI too.
To disable colors, set NO_COLOR (https://no-color.org/).
Types ¶
type KeyMap ¶
type Rave ¶
type Rave struct { // Show extra details useful for debugging a desynced rave. ShowDetails bool // Address (host:port) on which to listen for auth callbacks. AuthCallbackAddr string // Configuration for syncing with Spotify. SpotifyAuth *spotifyauth.Authenticator // File path where tokens will be cached. SpotifyTokenPath string // The animation to display. Frames SpinnerFrames // contains filtered or unexported fields }
func (*Rave) SpotifyCallbackURL ¶
type SpinnerFrames ¶ added in v0.10.0
SpinnerFrames contains animation frames.
type Vterm ¶
type Vterm struct { Offset int Height int Width int Prefix string // contains filtered or unexported fields }
func (*Vterm) Bytes ¶ added in v0.4.1
Bytes returns the output for the given region of the terminal, with ANSI formatting.
func (*Vterm) LastLine ¶ added in v0.8.0
LastLine returns the last line of visible text, with ANSI formatting, but without any trailing whitespace.