diff --git a/.editorconfig b/.editorconfig
index 3656fd0..78348eb 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -71,7 +71,7 @@ dotnet_naming_symbols.private_instance_fields_symbols.resharper_applicable_kinds
dotnet_naming_symbols.private_instance_fields_symbols.resharper_required_modifiers = instance
dotnet_naming_symbols.private_instance_fields_symbols_1.applicable_accessibilities = private
dotnet_naming_symbols.private_instance_fields_symbols_1.applicable_kinds = field
-dotnet_naming_symbols.private_instance_fields_symbols_1.resharper_applicable_kinds = field,readonly_field
+dotnet_naming_symbols.private_instance_fields_symbols_1.resharper_applicable_kinds = field, readonly_field
dotnet_naming_symbols.private_instance_fields_symbols_1.resharper_required_modifiers = instance
dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
@@ -84,11 +84,11 @@ dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = reado
dotnet_naming_symbols.private_static_readonly_symbols.resharper_applicable_kinds = readonly_field
dotnet_naming_symbols.private_static_readonly_symbols.resharper_required_modifiers = static
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
-dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
+dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_accessibilities = *
-dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds =
+dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_required_modifiers = instance
dotnet_sort_system_directives_first = false
@@ -143,7 +143,7 @@ resharper_formatter_tags_enabled = true
resharper_indent_preprocessor_if = usual_indent
resharper_indent_preprocessor_other = do_not_change
resharper_indent_raw_literal_string = indent
-resharper_instance_members_qualify_declared_in =
+resharper_instance_members_qualify_declared_in =
resharper_keep_existing_attribute_arrangement = true
resharper_keep_existing_declaration_block_arrangement = true
resharper_keep_existing_embedded_block_arrangement = true
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f5f5313..59df871 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -37,3 +37,4 @@ jobs:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
dotnet nuget push src/CodeOfChaos.Ansi/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
+ dotnet nuget push src/CodeOfChaos.Ansi.Generators/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
diff --git a/CodeOfChaos.Ansi.sln b/CodeOfChaos.Ansi.sln
index 87e450d..a63ffde 100644
--- a/CodeOfChaos.Ansi.sln
+++ b/CodeOfChaos.Ansi.sln
@@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.CodeOfChaos.Ansi", "s
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "example", "example", "{A5F3433A-9F39-4372-B994-E262F597F1D2}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeOfChaos.Ansi.Generators", "src\CodeOfChaos.Ansi.Generators\CodeOfChaos.Ansi.Generators.csproj", "{82941FB2-B148-4A12-8DFB-71769B4F4DD8}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -32,10 +34,15 @@ Global
{ADEADD97-0AFA-4D9E-970B-9FFB932949B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADEADD97-0AFA-4D9E-970B-9FFB932949B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADEADD97-0AFA-4D9E-970B-9FFB932949B3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {82941FB2-B148-4A12-8DFB-71769B4F4DD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {82941FB2-B148-4A12-8DFB-71769B4F4DD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {82941FB2-B148-4A12-8DFB-71769B4F4DD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {82941FB2-B148-4A12-8DFB-71769B4F4DD8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{26284571-0E09-4BAF-8C2B-DF87DCC1BA0B} = {8DD280D4-1E14-4D5E-AFE6-58DD8F079DCC}
{64B26DED-68C3-47FF-B409-1C8FAD4F9176} = {197E72AD-DEAB-4350-AFC3-A3BB38720BF5}
{ADEADD97-0AFA-4D9E-970B-9FFB932949B3} = {AF1A203C-6EF1-440E-BB3C-55B1DBFE9C19}
+ {82941FB2-B148-4A12-8DFB-71769B4F4DD8} = {197E72AD-DEAB-4350-AFC3-A3BB38720BF5}
EndGlobalSection
EndGlobal
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e69de29
diff --git a/assets/icon.png b/assets/icon.png
new file mode 100644
index 0000000..0f207d9
Binary files /dev/null and b/assets/icon.png differ
diff --git a/src/CodeOfChaos.Ansi.Generators/Class1.cs b/src/CodeOfChaos.Ansi.Generators/Class1.cs
new file mode 100644
index 0000000..630fbb3
--- /dev/null
+++ b/src/CodeOfChaos.Ansi.Generators/Class1.cs
@@ -0,0 +1,4 @@
+namespace CodeOfChaos.Ansi.Generators;
+public class Class1 {
+
+}
diff --git a/src/CodeOfChaos.Ansi.Generators/CodeOfChaos.Ansi.Generators.csproj b/src/CodeOfChaos.Ansi.Generators/CodeOfChaos.Ansi.Generators.csproj
new file mode 100644
index 0000000..7b46178
--- /dev/null
+++ b/src/CodeOfChaos.Ansi.Generators/CodeOfChaos.Ansi.Generators.csproj
@@ -0,0 +1,52 @@
+
+
+
+ netstandard2.0
+ true
+ enable
+ latest
+
+ true
+ false
+ true
+ true
+ true
+ true
+ NU5128
+
+
+ CodeOfChaos.Ansi.Generators
+ 1.0.0-preview.0
+ Anna Sas
+ A library to write Ansi Colored text as a stringbuilder
+ https://github.com/code-of-chaos/cs-code_of_chaos-ansi/
+ ansi input stringbuilder
+ true
+ true
+ true
+ embedded
+ LICENSE
+ README.md
+ icon.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/CodeOfChaos.Ansi/AnsiCodes.cs b/src/CodeOfChaos.Ansi/AnsiCodes.cs
new file mode 100644
index 0000000..00d9908
--- /dev/null
+++ b/src/CodeOfChaos.Ansi/AnsiCodes.cs
@@ -0,0 +1,435 @@
+// ---------------------------------------------------------------------------------------------------------------------
+// Imports
+// ---------------------------------------------------------------------------------------------------------------------
+namespace CodeOfChaos.Ansi;
+// ---------------------------------------------------------------------------------------------------------------------
+// Code
+// ---------------------------------------------------------------------------------------------------------------------
+// The following class is created by using the following resources:
+// - https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#ansi-escape-sequences
+// - https://github.com/code-of-chaos/AthenaColor (my own package)
+///
+/// Provides ANSI escape codes for cursor control, erase functions, graphics modes, color codes, screen modes, and
+/// keyboard strings.
+///
+public static class AnsiCodes {
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Cursor Controls
+ // -----------------------------------------------------------------------------------------------------------------
+ ///
+ /// Represents the ANSI escape code for moving the cursor to the home position.
+ ///
+ public static string CursorHome => "\e[H";
+ ///
+ /// Represents the ANSI escape code for querying the cursor position in the terminal.
+ ///
+ public static string CursorPosition => "\e[6n";
+ ///
+ /// Represents the escape code for moving the cursor up.
+ ///
+ public static string CursorMoveUp => "\e M";
+ ///
+ /// Represents the ANSI escape code for saving the cursor position.
+ ///
+ public static string CursorPositionSaveDec => "\e 7";
+ ///
+ /// Represents the ANSI escape sequence for restoring the cursor position.
+ ///
+ public static string CursorPositionRestoreDec => "\e 8";
+ ///
+ /// Represents the ANSI escape sequence for saving the current cursor position.
+ ///
+ public static string CursorPositionSaveSco => "\e[s";
+ ///
+ /// Represents the ANSI escape code for restoring the cursor position saved with Sco (Save Cursor) code.
+ ///
+ public static string CursorPositionRestoreSco => "\e[u";
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Erase Functions
+ // -----------------------------------------------------------------------------------------------------------------
+ ///
+ /// Represents ANSI escape codes for erasing parts of the display.
+ ///
+ public static string EraseInDisplay => "\e[J";
+ ///
+ /// Represents the ANSI escape code for erasing from the current cursor position to the end of the screen.
+ ///
+ public static string EraseFromCursorToScreenEnd => "\e[0J";
+ ///
+ /// Erases all characters from the current cursor position to the beginning of the screen.
+ ///
+ public static string EraseFromCursorToScreenBeginning => "\e[1J";
+ ///
+ /// Gets the ANSI escape sequence to erase the entire screen.
+ ///
+ public static string EraseEntireScreen => "\e[2J";
+ ///
+ /// The ANSI code for erasing saved lines on the terminal screen.
+ ///
+ public static string EraseSavedLines => "\e[3J";
+ ///
+ /// Represents the ANSI escape code for erasing a line.
+ ///
+ public static string EraseInLine => "\e[K";
+ ///
+ /// Represents an ANSI escape code for erasing characters from the current cursor position to the end of the line.
+ ///
+ public static string EraseFromCursorToLineEnd => "\e[0K";
+ ///
+ /// Erases from the beginning of the line to the cursor position.
+ ///
+ public static string EraseFromLineBeginningToCursor => "\e[1K";
+ ///
+ /// Represents the ANSI escape code for erasing the entire line on the console.
+ ///
+ public static string EraseEntireLine => "\e[2K";
+ ///
+ /// The ResetGraphicsModes property represents the ANSI escape code that resets all graphics modes to their default
+ /// values.
+ ///
+ public static string ResetGraphicsModes => "\e[0m";
+ ///
+ /// Sets the bold mode in ANSI escape codes.
+ ///
+ public static string SetBoldMode => "\e[1m";
+ ///
+ /// Reset the bold mode.
+ ///
+ public static string ResetBoldMode => "\e[22m";
+ ///
+ /// Sets the dim mode for the ANSI escape codes.
+ ///
+ ///
+ /// The dim mode reduces the intensity of the text color.
+ ///
+ public static string SetDimMode => "\e[2m";
+ ///
+ /// Represents the ANSI escape sequence to reset the dim mode.
+ /// Dim mode is used to reduce the intensity of the text color.
+ ///
+ public static string ResetDimMode => "\e[22m";
+ ///
+ /// Sets the italic mode for the text.
+ ///
+ ///
+ /// This method sets the italic mode for the text. When the italic mode is enabled, the text will be displayed in
+ /// italic font style.
+ ///
+ public static string SetItalicMode => "\e[3m";
+ ///
+ /// Represents the ANSI escape code for resetting the italic mode.
+ ///
+ public static string ResetItalicMode => "\e[23m";
+ ///
+ /// Sets the underline mode for text.
+ ///
+ ///
+ /// The underline mode adds a underline effect to the text.
+ ///
+ public static string SetUnderlineMode => "\e[4m";
+ ///
+ /// An ANSI escape code that resets the underline mode for text in a console.
+ ///
+ public static string ResetUnderlineMode => "\e[24m";
+ ///
+ /// Set the blinking mode for text representation in ANSI escape codes.
+ ///
+ ///
+ /// This property sets the blinking mode for the text represented using ANSI escape codes.
+ /// The blinking mode is used to make the text blink on the console.
+ ///
+ ///
+ /// The ANSI escape code for setting the blinking mode.
+ ///
+ public static string SetBlinkingMode => "\e[5m";
+ ///
+ /// Resets the blinking mode.
+ ///
+ public static string ResetBlinkingMode => "\e[25m";
+ ///
+ /// Represents the code for setting the inverse mode in ANSI escape sequences.
+ ///
+ public static string SetInverseMode => "\e[7m";
+ ///
+ /// Represents the ANSI escape code for resetting the inverse mode.
+ /// The inverse mode swaps the foreground and background colors, making the background become the foreground and vice
+ /// versa.
+ /// Use this code to reset the inverse mode after enabling it.
+ ///
+ public static string ResetInverseMode => "\e[27m";
+ ///
+ /// Sets the hidden mode.
+ ///
+ /// The hidden mode ANSI code.
+ public static string SetHiddenMode => "\e[8m";
+ ///
+ /// Resets the hidden mode of ANSI escape codes, which hides the text.
+ ///
+ ///
+ /// This function resets the hidden mode of ANSI escape codes, which hides the text.
+ /// It reverts the hidden mode back to the default mode, allowing the text to be visible again.
+ ///
+ /// A string representing the ANSI escape code to reset the hidden mode.
+ public static string ResetHiddenMode => "\e[28m";
+ ///
+ /// Sets the strikethrough mode for text output.
+ ///
+ public static string SetStrikethroughMode => "\e[9m";
+ ///
+ /// Resets the strikethrough mode.
+ ///
+ public static string ResetStrikethroughMode => "\e[29m";
+ ///
+ /// Represents the ANSI escape code for setting the foreground color to black.
+ ///
+ public static string CommonForegroundBlack => "\e[30m";
+ ///
+ /// Represents the ANSI escape code for setting the foreground color to red.
+ ///
+ public static string CommonForegroundRed => "\e[31m";
+ ///
+ /// Represents the ANSI escape code for setting the foreground color to green.
+ ///
+ public static string CommonForegroundGreen => "\e[32m";
+ ///
+ /// Represents the ANSI escape code for setting the foreground color to yellow.
+ ///
+ public static string CommonForegroundYellow => "\e[33m";
+ ///
+ /// Represents the ANSI escape code for setting the foreground color to blue.
+ ///
+ public static string CommonForegroundBlue => "\e[34m";
+ ///
+ /// Represents the ANSI escape code for setting the foreground color to magenta in a console.
+ ///
+ public static string CommonForegroundMagenta => "\e[35m";
+ ///
+ /// Represents the ANSI escape code for setting the foreground color to cyan.
+ ///
+ public static string CommonForegroundCyan => "\e[36m";
+ ///
+ /// Represents the ANSI escape code for setting the foreground color to white (default).
+ ///
+ public static string CommonForegroundWhite => "\e[37m";
+ ///
+ /// Represents the ANSI escape code for the default common foreground color.
+ ///
+ public static string CommonForegroundDefault => "\e[39m";
+
+ ///
+ /// Represents the ANSI escape code for setting the background color to black.
+ ///
+ public static string CommonBackgroundBlack => "\e[40m";
+ ///
+ /// Represents the ANSI escape code for setting the background color to red.
+ ///
+ public static string CommonBackgroundRed => "\e[41m";
+ ///
+ /// Represents the ANSI escape code for setting the background color to green.
+ ///
+ public static string CommonBackgroundGreen => "\e[42m";
+ ///
+ /// Provides the ANSI escape code for setting the background color to yellow.
+ ///
+ public static string CommonBackgroundYellow => "\e[43m";
+ ///
+ /// Represents the ANSI escape code for setting the background color to Blue.
+ ///
+ public static string CommonBackgroundBlue => "\e[44m";
+ ///
+ /// Represents the ANSI escape code for setting the text background color to Magenta.
+ ///
+ public static string CommonBackgroundMagenta => "\e[45m";
+ ///
+ /// Represents the ANSI escape code for setting the background color to cyan.
+ ///
+ ///
+ /// This property is a member of the class.
+ /// The ANSI escape code for setting the background color to cyan is \x1B[46m.
+ ///
+ public static string CommonBackgroundCyan => "\e[46m";
+ ///
+ /// Represents the ANSI escape code for setting the common background color to white.
+ ///
+ public static string CommonBackgroundWhite => "\e[47m";
+ ///
+ /// Represents the ANSI escape sequence for setting the default background color.
+ ///
+ public static string CommonBackgroundDefault => "\e[49m";
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Common private modes
+ // -----------------------------------------------------------------------------------------------------------------
+ ///
+ /// Represents the ANSI code for hiding the cursor.
+ ///
+ public static string CursorInvisible => "\e[?25l";
+ ///
+ /// Represents the cursor visible property.
+ ///
+ public static string CursorVisible => "\e[?25h";
+ ///
+ /// Represents the ANSI escape code for restoring the screen.
+ ///
+ public static string RestoreScreen => "\e[?47l";
+ ///
+ /// Represents a property that returns the ANSI escape code for saving the screen.
+ ///
+ public static string SaveScreen => "\e[?47h";
+ ///
+ /// Enables the alternative buffer mode.
+ ///
+ ///
+ /// The alternative buffer mode provides a separate screen buffer for displaying information.
+ /// This can be useful for displaying temporary or auxiliary information without disrupting the
+ /// main screen buffer.
+ ///
+ ///
+ public static string EnableAlternativeBuffer => "\e[?1049h";
+ ///
+ /// Represents the ANSI escape code for disabling the alternative buffer mode.
+ ///
+ public static string DisableAlternativeBuffer => "\e[?1049l";
+ ///
+ /// Moves the cursor to the specified position in the console output buffer.
+ ///
+ /// The line number to move the cursor to. The first line is 1.
+ /// The column number to move the cursor to. The first column is 1.
+ ///
+ /// The ANSI escape code to move the cursor to the specified position.
+ ///
+ public static string CursorMoveH(int line, int column) => $"\e[{line};{column}H";
+ ///
+ /// Moves the cursor to the specified line and column position.
+ ///
+ /// The line number to move the cursor to.
+ /// The column number to move the cursor to.
+ ///
+ /// A string representing the ANSI escape sequence to move the cursor to the specified position.
+ ///
+ public static string CursorMoveF(int line, int column) => $"\e[{line};{column}f";
+ ///
+ /// Moves the cursor up a specified number of lines.
+ ///
+ /// The number of lines to move the cursor up.
+ ///
+ public static string CursorMoveUpLines(int lines) => $"\e[{lines}A";
+ ///
+ /// Moves the cursor down the specified number of lines.
+ ///
+ /// The number of lines to move the cursor down.
+ ///
+ public static string CursorMoveDownLines(int lines) => $"\e[{lines}B";
+ ///
+ /// Moves the cursor right by the specified number of columns.
+ ///
+ /// The number of columns to move the cursor right.
+ /// The ANSI escape code to move the cursor right.
+ public static string CursorMoveRightColumns(int columns) => $"\e[{columns}C";
+ ///
+ /// Moves the cursor to the left by the specified number of columns.
+ ///
+ /// The number of columns to move the cursor to the left.
+ /// The ANSI escape sequence to move the cursor to the left by the specified number of columns.
+ public static string CursorMoveLeftColumns(int columns) => $"\e[{columns}D";
+ ///
+ /// Moves the cursor to the beginning of the next line.
+ ///
+ /// The number of lines to move down. Positive values move down, negative values move up.
+ /// A string that represents the ANSI escape code for moving the cursor to the beginning of the next line.
+ public static string CursorMoveBeginningNextLine(int lines) => $"\e[{lines}E";
+ ///
+ /// Moves the cursor to the beginning of the previous line.
+ ///
+ /// The number of lines to move the cursor up.
+ /// The ANSI escape code to move the cursor to the beginning of the previous line.
+ public static string CursorMoveBeginningPreviousLine(int lines) => $"\e[{lines}F";
+ ///
+ /// Moves the cursor to the specified column position.
+ ///
+ /// The column position to move the cursor to.
+ /// The ANSI escape sequence to move the cursor to the specified column position.
+ public static string CursorMoveColumn(int columns) => $"\e[{columns}G";
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Colors / Graphics Mode
+ // -----------------------------------------------------------------------------------------------------------------
+ ///
+ /// Set the graphics modes.
+ ///
+ /// The graphics mode codes.
+ /// The ANSI escape sequence to set the specified graphics modes.
+ public static string SetGraphicsModes(params int[] codes) => $"\e[{string.Join(";", codes)}m";
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Color codes
+ // -----------------------------------------------------------------------------------------------------------------
+ ///
+ /// Sets the foreground color using a byte value.
+ ///
+ /// The byte value representing the color.
+ /// The ANSI escape sequence for setting the foreground color.
+ public static string ByteForegroundColor(byte color) => $"\e[38;5;{(int)color}m";
+ ///
+ /// Sets the background color of the console using the given byte color value.
+ ///
+ /// The byte color value representing the background color of the console.
+ /// The ANSI escape code for setting the background color.
+ public static string ByteBackgroundColor(byte color) => $"\e[48;5;{(int)color}m";
+ ///
+ /// Sets the underline color using the ANSI escape code.
+ ///
+ /// The color to set the underline to. Valid values are 0-255.
+ /// The ANSI escape code to set the underline color.
+ public static string ByteUnderlineColor(byte color) => $"\e[58;5;{(int)color}m";
+
+ ///
+ /// Sets the foreground color of the console using RGB values.
+ ///
+ /// The RGB color value.
+ /// The ANSI escape sequence for setting the foreground color.
+ public static string RgbForegroundColor(ByteVector3 color) => $"\e[38;2;{color.ToAnsiString()}m";
+ ///
+ /// Sets the RGB background color using ANSI escape codes.
+ ///
+ /// The RGB color in ByteVector3 format.
+ /// The ANSI escape code string to set the RGB background color.
+ public static string RgbBackgroundColor(ByteVector3 color) => $"\e[48;2;{color.ToAnsiString()}m";
+ ///
+ /// Sets the RGB underline color for the text.
+ ///
+ /// The RGB color values.
+ /// The ANSI escape sequence to set the RGB underline color for the text.
+ public static string RgbUnderlineColor(ByteVector3 color) => $"\e[58;2;{color.ToAnsiString()}m";
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Screen Modes
+ // -----------------------------------------------------------------------------------------------------------------
+ ///
+ /// Sets the screen mode.
+ ///
+ /// The value of the screen mode.
+ /// A string that represents the screen mode.
+ public static string SetScreenMode(int value) => $"\e[={value}h";
+ ///
+ /// Resets the screen mode to the specified value.
+ ///
+ /// The value to set the screen mode to.
+ /// A string containing the ANSI escape code to reset the screen mode.
+ public static string ResetScreenMode(int value) => $"\e[={value}l";
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Keyboard Strings
+ // -----------------------------------------------------------------------------------------------------------------
+ ///
+ /// Redefines a key to a code.
+ ///
+ /// The code of the key.
+ /// The string representation of the key.
+ ///
+ /// A string that represents the redefined key with the provided code and string representation.
+ ///
+ public static string RedefineKeyToCode(string code, string str) => $"\e[{code};{str}p";
+}
diff --git a/src/CodeOfChaos.Ansi/AnsiStringBuilder.cs b/src/CodeOfChaos.Ansi/AnsiStringBuilder.cs
new file mode 100644
index 0000000..c8cf379
--- /dev/null
+++ b/src/CodeOfChaos.Ansi/AnsiStringBuilder.cs
@@ -0,0 +1,29 @@
+// ---------------------------------------------------------------------------------------------------------------------
+// Imports
+// ---------------------------------------------------------------------------------------------------------------------
+using System.Text;
+
+namespace CodeOfChaos.Ansi;
+
+// ---------------------------------------------------------------------------------------------------------------------
+// Code
+// ---------------------------------------------------------------------------------------------------------------------
+public partial class AnsiStringBuilder {
+ private StringBuilder _builder = new();
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Methods
+ // -----------------------------------------------------------------------------------------------------------------
+ private AnsiStringBuilder BuilderAction(Action action) {
+ action();
+ return this;
+ }
+
+ public void Append(string value) => _builder.Append(value);
+ public void AppendLine(string value) => _builder.AppendLine(value);
+ public string ToStringAndClear() {
+ string result = _builder.ToString();
+ _builder.Clear();
+ return result;
+ }
+}
diff --git a/src/CodeOfChaos.Ansi/CodeOfChaos.Ansi.csproj b/src/CodeOfChaos.Ansi/CodeOfChaos.Ansi.csproj
index e0439ac..25139c3 100644
--- a/src/CodeOfChaos.Ansi/CodeOfChaos.Ansi.csproj
+++ b/src/CodeOfChaos.Ansi/CodeOfChaos.Ansi.csproj
@@ -1,10 +1,38 @@
-
net9.0
- latest
enable
enable
+ true
+
+
+ CodeOfChaos.Ansi
+ 1.0.0-preview.0
+ Anna Sas
+ A library to write Ansi Colored text as a stringbuilder
+ https://github.com/code-of-chaos/cs-code_of_chaos-ansi/
+ ansi input stringbuilder
+ true
+ true
+ true
+ embedded
+ LICENSE
+ README.md
+ icon.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Tools.CodeOfChaos.Ansi/Program.cs b/src/Tools.CodeOfChaos.Ansi/Program.cs
index b342847..66a2400 100644
--- a/src/Tools.CodeOfChaos.Ansi/Program.cs
+++ b/src/Tools.CodeOfChaos.Ansi/Program.cs
@@ -23,7 +23,8 @@ public static async Task Main(string[] args) {
// Sometimes CLI params is not the answer.
// Code is the true saviour
string projects = string.Join(";",
- "CodeOfChaos.Ansi"
+ "CodeOfChaos.Ansi",
+ "CodeOfChaos.Ansi.Generators"
);
string oneLineArgs = InputHelper.ToOneLine(args).Replace("%PROJECTS%", projects);