Table of Contents

Class Spinner

Namespace
Retro.Crt
Assembly
Retro.Crt.dll

Single-line animated spinner. Use once via using var s = Spinner.Show("loading…"); — disposing stops the animation, clears the spinner line, and emits a newline.

public sealed class Spinner : IDisposable
Inheritance
Spinner
Implements
Inherited Members

Remarks

Without ANSI support (output redirected, NO_COLOR, dumb terminal) the spinner does not animate: it writes the label once on Show(string, SpinnerStyle, Color?, int) and a newline on Stop(). This keeps log files free of dozens of overwrite frames.

The spinner owns its line for its lifetime — concurrent writes from other code while the spinner is active will be clobbered by the next repaint. Either route writes through Update(string) / Stop(string?, Color?), or stop the spinner first.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Show(string, SpinnerStyle, Color?, int)

Begin a new spinner.

public static Spinner Show(string label, SpinnerStyle style = SpinnerStyle.Pipe, Color? color = null, int msPerFrame = 80)

Parameters

label string

Text shown to the right of the animated glyph.

style SpinnerStyle

Frame set. Defaults to Pipe.

color Color?

Optional foreground color for the glyph.

msPerFrame int

Frame duration in milliseconds. Clamped to ≥1.

Returns

Spinner

Stop()

Stop the spinner with no final state.

public void Stop()

Stop(string?, Color?)

Stop the spinner and write a final state in place — useful for "✓ done" / "✗ failed" indications. The final label fully replaces the spinner line; bring your own glyph.

public void Stop(string? finalLabel, Color? finalColor = null)

Parameters

finalLabel string
finalColor Color?

Update(string)

Replace the label without stopping the animation.

public void Update(string label)

Parameters

label string