theme/devtools/progress.go

Functions Structs

Functions

func PaintProgress

PaintProgress renders a circular progress indicator according to DevTools specifications.

func (p ProgressPainter) PaintProgress(canvas widget.Canvas, ps progress.PaintState) {
	if ps.Bounds.IsEmpty() {
		return
	}

	bounds := ps.Bounds
	centerX := bounds.Min.X + bounds.Width()/2
	centerY := bounds.Min.Y + bounds.Height()/2
	center := geometry.Pt(centerX, centerY)

	// Use the smaller of width/height for the radius, minus stroke width.
	availDiameter := ps.Diameter
	if bounds.Width() < availDiameter {
		availDiameter = bounds.Width()
	}
	if bounds.Height() < availDiameter {
		availDiameter = bounds.Height()
	}
	radius := (availDiameter - ps.StrokeWidth) / 2
	if radius <= 0 {
		return
	}

	if ps.Indeterminate {
		p.paintIndeterminate(canvas, ps, center, radius)
	} else {
		p.paintDeterminate(canvas, ps, center, radius)
	}
}

Structs

type ProgressPainter struct

ProgressPainter renders progress indicators using DevTools design tokens.

DevTools progress uses a 2px stroke: Gray3 track with Blue6 fill for both

linear and circular indicators. The indeterminate mode uses an animated

Blue6 arc, matching JetBrains IDE progress bar styling.

 

If Theme is nil, ProgressPainter falls back to the default DevTools dark palette.

type ProgressPainter struct {
	Theme *Theme	// nil uses default DevTools dark fallback
}