1
1
# ⚡️ Better Input for C# with ` buffer `
2
2
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 >
4
6
5
7
[ ![ 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 )
6
8
[ ![ 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();
90
92
```
91
93
92
94
### 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 >
94
98
95
99
### 🧩 Syntax Highlighting in Real-time
96
100
``` cpp
97
101
PradBuffer Buffer = new PradBuffer();
98
102
103
+ Console.WriteLine(" Enter something to get started, " );
104
+
99
105
string s = " " ;
100
106
107
+ // Supports Console Colors
101
108
Buffer.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);
105
118
106
119
Buffer.EnableSyntaxHighlighting = true ;
107
120
@@ -119,7 +132,9 @@ while(true){
119
132
```
120
133
121
134
#### 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 >
123
138
124
139
### 🚀 Using its maximum potential
125
140
0 commit comments