-
-
Notifications
You must be signed in to change notification settings - Fork 457
/
ProgressBarColumn.cs
48 lines (42 loc) · 1.47 KB
/
ProgressBarColumn.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
namespace Spectre.Console;
/// <summary>
/// A column showing task progress as a progress bar.
/// </summary>
public sealed class ProgressBarColumn : ProgressColumn
{
/// <summary>
/// Gets or sets the width of the column.
/// </summary>
public int? Width { get; set; } = 40;
/// <summary>
/// Gets or sets the style of completed portions of the progress bar.
/// </summary>
public Style CompletedStyle { get; set; } = Color.Yellow;
/// <summary>
/// Gets or sets the style of a finished progress bar.
/// </summary>
public Style FinishedStyle { get; set; } = Color.Green;
/// <summary>
/// Gets or sets the style of remaining portions of the progress bar.
/// </summary>
public Style RemainingStyle { get; set; } = Color.Grey;
/// <summary>
/// Gets or sets the style of an indeterminate progress bar.
/// </summary>
public Style IndeterminateStyle { get; set; } = ProgressBar.DefaultPulseStyle;
/// <inheritdoc/>
public override IRenderable Render(RenderOptions options, ProgressTask task, TimeSpan deltaTime)
{
return new ProgressBar
{
MaxValue = task.MaxValue,
Value = task.Value,
Width = Width,
CompletedStyle = CompletedStyle,
FinishedStyle = FinishedStyle,
RemainingStyle = RemainingStyle,
IndeterminateStyle = IndeterminateStyle,
IsIndeterminate = task.IsIndeterminate,
};
}
}