11# ⚡️ Better Input for C# with ` buffer `
22
3- ![ Buffer package in action] ( https://raw.githubusercontent.com/pradosh-arduino/buffer/ac911024b63e8a7f5b245be591859991fe23aec4/buffer.gif )
3+ <div align =" center " >
4+ <img src="https://raw.githubusercontent.com/pradosh-arduino/buffer/ac911024b63e8a7f5b245be591859991fe23aec4/buffer.gif" alt="Buffer package in action" style="width: 80%; height: auto;" />
5+ </div >
46
57[ ![ NuGet Downloads] ( https://img.shields.io/nuget/dt/buffer?style=flat-square&logo=nuget&logoColor=ffffff&logoSize=auto&label=Downloads&labelColor=323ca8&color=545454 )] ( https://www.nuget.org/stats/packages/buffer?groupby=Version )
68[ ![ GitHub Actions Workflow Status] ( https://img.shields.io/github/actions/workflow/status/pradosh-arduino/buffer/dotnet.yml?style=flat-square&logo=github&logoColor=ffffff&logoSize=auto&label=Build )] ( https://github.com/pradosh-arduino/buffer/actions/workflows/dotnet.yml )
@@ -90,18 +92,29 @@ InputBuffer.ClearBuffer();
9092```
9193
9294### Here is a demo of Limited Buffer Size of 10 characters
93- ![ buffer-limit] ( https://raw.githubusercontent.com/pradosh-arduino/buffer/main/buffer-limit.gif )
95+ <div align =" center " >
96+ <img src="https://raw.githubusercontent.com/pradosh-arduino/buffer/main/buffer-limit.gif" alt="buffer-limit" style="width: 70%; height: auto;" />
97+ </div >
9498
9599### 🧩 Syntax Highlighting in Real-time
96100``` cpp
97101PradBuffer Buffer = new PradBuffer();
98102
103+ Console.WriteLine(" Enter something to get started, " );
104+
99105string s = " " ;
100106
107+ // Supports Console Colors
101108Buffer.SyntaxHighlights.Add(" prad" , ConsoleColor.Red);
102- Buffer.SyntaxHighlights.Add(" static" , ConsoleColor.Blue);
103- Buffer.SyntaxHighlights.Add(" public" , ConsoleColor.Green);
104- Buffer.SyntaxHighlights.Add(" =" , ConsoleColor.Yellow);
109+
110+ // Supports Integers, color will be selected with respective to ConsoleColor enum.
111+ Buffer.SyntaxHighlights.Add(" static" , 9 );
112+
113+ // Directly supports ANSI Escape codes. **Beware any mistakes CAN and WILL break the input.**
114+ Buffer.SyntaxHighlights.Add(" public" , " \x1b [32m" ); // Green ANSI Escape code.
115+
116+ // ! Throws exception if any other data type is being used.
117+ // Buffer.SyntaxHighlights.Add("=", 56.3d);
105118
106119Buffer.EnableSyntaxHighlighting = true ;
107120
@@ -119,7 +132,9 @@ while(true){
119132```
120133
121134#### Demo of Syntax Highlighting
122- ![ Syntax Highlighting Demo] ( https://raw.githubusercontent.com/pradosh-arduino/buffer/main/syntax-highlights.gif )
135+ <div align =" center " >
136+ <img src="https://raw.githubusercontent.com/pradosh-arduino/buffer/main/syntax-highlights.gif" alt="Syntax Highlighting Demo" style="width: 70%; height: auto;" />
137+ </div >
123138
124139### 🚀 Using its maximum potential
125140
0 commit comments