Example #1
0
            public override void Render(ConsoleRenderer renderer, Region region)
            {
                var p    = Math.Clamp(Progress, 0, 1.0);
                var done = (int)(p * 100);

                const int textWidth  = 6;
                var       text       = p.ToString("P");
                const int aHalf      = 47;
                var       firstFill  = Math.Clamp(done, 0, aHalf);
                var       secondFill = Math.Clamp(done - (aHalf + textWidth), 0, aHalf);

                var result = new ContainerSpan(
                    Title.StyleUnderline(),
                    ": ".AsTextSpan(),
                    new ContainerSpan(
                        new string('=', firstFill).StyleColor(ForegroundColorSpan.LightGreen()),
                        new string('-', aHalf - firstFill).StyleColor(ForegroundColorSpan.LightGray())
                        ),
                    done switch
                {