mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-18 21:08:15 +08:00
Add support for fake input in asciicast recordings
* Fixes a bug with `SelectionPrompt` and page size. * Allow `IAnsiConsoleInput` to return `null`.
This commit is contained in:

committed by
Phil Scott

parent
46abadaccb
commit
450d87f5d3
@ -0,0 +1,29 @@
|
||||
using Spectre.Console;
|
||||
|
||||
namespace Generator.Commands.Samples
|
||||
{
|
||||
internal class CanvasSample : BaseSample
|
||||
{
|
||||
public override void Run(IAnsiConsole console)
|
||||
{
|
||||
var canvas = new Canvas(16, 16);
|
||||
|
||||
// Draw some shapes
|
||||
for(var i = 0; i < canvas.Width; i++)
|
||||
{
|
||||
// Cross
|
||||
canvas.SetPixel(i, i, Color.White);
|
||||
canvas.SetPixel(canvas.Width - i - 1, i, Color.White);
|
||||
|
||||
// Border
|
||||
canvas.SetPixel(i, 0, Color.Red);
|
||||
canvas.SetPixel(0, i, Color.Green);
|
||||
canvas.SetPixel(i, canvas.Height - 1, Color.Blue);
|
||||
canvas.SetPixel(canvas.Width - 1, i, Color.Yellow);
|
||||
}
|
||||
|
||||
// Render the canvas
|
||||
console.Write(canvas);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user