thinking

package
v1.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package thinking provides Crush's pending-request animation as a reusable Bubble Tea component.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anim

type Anim struct {
	// contains filtered or unexported fields
}

Anim is a Bubble Tea component for Crush's pending/thinking animation.

func New

func New(opts Settings) *Anim

New creates a new animation instance with the specified settings.

func (*Anim) Animate

func (a *Anim) Animate(msg StepMsg) tea.Cmd

Animate advances the animation to the next step.

func (*Anim) Render

func (a *Anim) Render() string

Render renders the current state of the animation.

func (*Anim) SetLabel

func (a *Anim) SetLabel(newLabel string)

SetLabel updates the label text and re-renders it.

func (*Anim) Start

func (a *Anim) Start() tea.Cmd

Start starts the animation.

func (*Anim) Step

func (a *Anim) Step() tea.Cmd

Step is a command that triggers the next step in the animation.

func (*Anim) Width

func (a *Anim) Width() int

Width returns the total width of the animation, including the animated ellipsis when a label is present.

type Colors

type Colors struct {
	GradientA color.Color
	GradientB color.Color
	Label     color.Color
}

Colors groups the animation's configurable colors.

func DefaultColors

func DefaultColors() Colors

DefaultColors returns the same color palette Crush uses today for pending and thinking animations.

type Settings

type Settings struct {
	ID          string
	Size        int
	Label       string
	LabelColor  color.Color
	GradColorA  color.Color
	GradColorB  color.Color
	CycleColors bool
	SkipIntro   bool
}

Settings defines animation settings.

type StepMsg

type StepMsg struct{ ID string }

StepMsg is a message type used to trigger the next step in the animation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL