using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Cecil_Libraries.ANSI_Utils.Lists;
using Cecil_Libraries.ANSI_Utils.Objects;
using Cecil_Libraries.ANSI_Utils.Util;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Organization Cecil Libraries, Founder(s) Chaosyr")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A library of ANSI Utilities for the C# Console environment, mainly Color Modes [foreground and background], and Text Processing Modes, also includes RGB Conversions for ColorRGB")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0+2dce969676db85404a9ea6cbe35e4a2ca893bb73")]
[assembly: AssemblyProduct("Cecil ANSI Utils")]
[assembly: AssemblyTitle("Cecil ANSI Utils")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Cecil-Libraries/Cecil-ANSI-Utils")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Cecil_Libraries.ANSI_Utils.Util
{
public class ColorBaseTypeSwitch
{
public static int ColorBaseTypeSwitchString(bool reset, string type)
{
int result = 0;
if (reset)
{
switch (type)
{
case "Regular":
result = 0;
break;
case "Bold":
result = int.Parse("2" + 2);
break;
case "Dulled":
result = int.Parse("2" + 2);
break;
case "Italic":
result = int.Parse("2" + 3);
break;
case "Underlined":
result = int.Parse("2" + 4);
break;
case "Blink":
result = int.Parse("2" + 5);
break;
case "Rapid":
result = int.Parse("2" + 6);
break;
case "Highlight":
result = int.Parse("2" + 7);
break;
case "Underlight":
result = int.Parse("2" + 8);
break;
case "Strikethrough":
result = int.Parse("2" + 9);
break;
case "Doubleline":
result = int.Parse("2" + 4);
break;
case "Overlined":
result = int.Parse("5" + 5);
break;
case "Framed":
result = int.Parse("5" + 4);
break;
case "Encircled":
result = int.Parse("5" + 4);
break;
}
}
else if (!reset)
{
switch (type)
{
case "Regular":
result = 0;
break;
case "Bold":
result = 1;
break;
case "Dulled":
result = 2;
break;
case "Italic":
result = 3;
break;
case "Underlined":
result = 4;
break;
case "Blink":
result = 5;
break;
case "Rapid":
result = 6;
break;
case "Highlight":
result = 7;
break;
case "Underlight":
result = 8;
break;
case "Strikethrough":
result = 9;
break;
case "Doubleline":
result = 21;
break;
case "Overlined":
result = 53;
break;
case "Framed":
result = 51;
break;
case "Encircled":
result = 52;
break;
}
}
return result;
}
public static int ColorBaseTypeSwitchInt(bool reset, int type)
{
int result = 0;
if (reset)
{
switch (type)
{
case 0:
result = 0;
break;
case 1:
result = 22;
break;
case 21:
result = 24;
break;
case 51:
case 52:
result = 54;
break;
case 53:
result = 55;
break;
default:
result = int.Parse("2" + type);
break;
}
}
else if (!reset)
{
result = type;
}
return result;
}
}
public class ColorTypeSwitch
{
public static (int BasicShade, int BaseColor) SwitchColorString(string color, int digitStart)
{
int num = 0;
int num2 = 0;
switch (color)
{
case "Black":
num = int.Parse(digitStart + "0");
num2 = 0;
break;
case "Red":
num = int.Parse(digitStart + "1");
num2 = 1;
break;
case "Green":
num = int.Parse(digitStart + "2");
num2 = 2;
break;
case "Yellow":
num = int.Parse(digitStart + "3");
num2 = 3;
break;
case "Blue":
num = int.Parse(digitStart + "4");
num2 = 4;
break;
case "Magenta":
num = int.Parse(digitStart + "5");
num2 = 5;
break;
case "Cyan":
num = int.Parse(digitStart + "6");
num2 = 6;
break;
case "White":
num = int.Parse(digitStart + "7");
num2 = 7;
break;
default:
num = int.Parse(digitStart + "7");
num2 = 7;
break;
}
return (BasicShade: num, BaseColor: num2);
}
public static (int BasicShade, int BaseColor) SwitchColorInt(int color, int digitStart)
{
return (BasicShade: int.Parse(digitStart.ToString() + color), BaseColor: color);
}
public static (int BasicShade, int Shade256) SwitchColor256Int(int shade, int digitStart)
{
return (BasicShade: int.Parse(digitStart + "8"), Shade256: shade);
}
public static (int BasicShade, int red, int green, int blue) SwitchColorRGBInt(int red, int green, int blue, int digitStart)
{
return (BasicShade: int.Parse(digitStart + "8"), red: red, green: green, blue: blue);
}
}
public class ConvertFromXToRGB
{
public static (int red, int green, int blue) ConverToRGBFromHex(string Code)
{
Code = Code.TrimStart(new char[1] { '#' });
int item = Convert.ToInt32(Code.Substring(0, 2), 16);
int item2 = Convert.ToInt32(Code.Substring(2, 2), 16);
int item3 = Convert.ToInt32(Code.Substring(4, 2), 16);
return (red: item, green: item2, blue: item3);
}
public static (int red, int green, int blue) ConvertToRGBFromGrayscale(int Gray)
{
return (red: Gray, green: Gray, blue: Gray);
}
public static (int red, int green, int blue) ConvertToRGBFromHueShadeValue(int hue, int shade, int value)
{
float num = (float)shade / 100f;
float num2 = (float)value / 100f;
float num3 = num * num2;
float num4 = num3 * (1f - Math.Abs((float)hue / 60f % 2f - 1f));
float num5 = num2 - num3;
if (hue < 60 && hue >= 0)
{
return BackToRGB(num3 + num5, num4 + num5, 0f + num5);
}
if (hue < 120 && hue >= 60)
{
return BackToRGB(num4 + num5, num3 + num5, 0f + num5);
}
if (hue < 180 && hue >= 120)
{
return BackToRGB(0f + num5, num3 + num5, num4 + num5);
}
if (hue < 240 && hue >= 180)
{
return BackToRGB(0f + num5, num4 + num5, num3 + num5);
}
if (hue < 300 && hue >= 240)
{
return BackToRGB(num4 + num5, 0f + num5, num3 + num5);
}
if (hue < 360 && hue >= 300)
{
return BackToRGB(num3 + num5, 0f + num5, num4 + num5);
}
return (red: 0, green: 0, blue: 0);
}
public static (int red, int green, int blue) ConvertToRGBFromHueSaturationLightness(int hue, int saturation, int lightness)
{
float num = (float)saturation / 100f;
float num2 = (float)lightness / 100f;
float num3 = (1f - Math.Abs(2f * num2 - 1f)) * num;
float num4 = num3 * (1f - Math.Abs((float)hue / 60f % 2f - 1f));
float num5 = num2 - num3 / 2f;
if (hue < 60 && hue >= 0)
{
return BackToRGB(num3 + num5, num4 + num5, 0f + num5);
}
if (hue < 120 && hue >= 60)
{
return BackToRGB(num4 + num5, num3 + num5, 0f + num5);
}
if (hue < 180 && hue >= 120)
{
return BackToRGB(0f + num5, num3 + num5, num4 + num5);
}
if (hue < 240 && hue >= 180)
{
return BackToRGB(0f + num5, num4 + num5, num3 + num5);
}
if (hue < 300 && hue >= 240)
{
return BackToRGB(num4 + num5, 0f + num5, num3 + num5);
}
if (hue < 360 && hue >= 300)
{
return BackToRGB(num3 + num5, 0f + num5, num4 + num5);
}
return (red: 0, green: 0, blue: 0);
}
private static (int red, int green, int blue) BackToRGB(float r, float g, float b)
{
return (red: (int)Math.Round(Math.Min(Math.Max(r, 0f), 1f) * 255f), green: (int)Math.Round(Math.Min(Math.Max(g, 0f), 1f) * 255f), blue: (int)Math.Round(Math.Min(Math.Max(b, 0f), 1f) * 255f));
}
}
public class Displayer
{
public static void DisplayListBased()
{
Console.WriteLine("Let's go through the List's");
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Regular");
int num = 0;
string[] colorList = ANSICodeLists.ColorList;
foreach (string text in colorList)
{
Console.WriteLine("\u001b[0m" + text + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Bold");
num = 0;
colorList = ANSICodeLists.BoldColorList;
foreach (string text2 in colorList)
{
Console.WriteLine("\u001b[0m" + text2 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Darkened");
num = 0;
colorList = ANSICodeLists.DarkenedColorList;
foreach (string text3 in colorList)
{
Console.WriteLine("\u001b[0m" + text3 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Italic");
num = 0;
colorList = ANSICodeLists.ItalicColorList;
foreach (string text4 in colorList)
{
Console.WriteLine("\u001b[0m" + text4 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Underlined");
num = 0;
colorList = ANSICodeLists.UnderlineColorList;
foreach (string text5 in colorList)
{
Console.WriteLine("\u001b[0m" + text5 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Flashy");
num = 0;
colorList = ANSICodeLists.FlashyColorList;
foreach (string text6 in colorList)
{
Console.WriteLine("\u001b[0m" + text6 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Highlighter");
num = 0;
colorList = ANSICodeLists.HighlighterColorText;
foreach (string text7 in colorList)
{
Console.WriteLine("\u001b[0m" + text7 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Invisible");
num = 0;
colorList = ANSICodeLists.InvisibleColorText;
foreach (string text8 in colorList)
{
Console.WriteLine("\u001b[0m" + text8 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Strikethrough");
num = 0;
colorList = ANSICodeLists.StrikethroughColorText;
foreach (string text9 in colorList)
{
Console.WriteLine("\u001b[0m" + text9 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Background");
num = 0;
colorList = ANSICodeLists.BackgroundColorList;
foreach (string text10 in colorList)
{
Console.WriteLine("\u001b[0m" + text10 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Regular");
num = 0;
colorList = ANSICodeLists.HighIntensityColorList;
foreach (string text11 in colorList)
{
Console.WriteLine("\u001b[0m" + text11 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Bold");
num = 0;
colorList = ANSICodeLists.HighIntensityBoldColorList;
foreach (string text12 in colorList)
{
Console.WriteLine("\u001b[0m" + text12 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Darkened");
num = 0;
colorList = ANSICodeLists.HighIntensityDarkenedColorList;
foreach (string text13 in colorList)
{
Console.WriteLine("\u001b[0m" + text13 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Italic");
num = 0;
colorList = ANSICodeLists.HighIntensityItalicColorList;
foreach (string text14 in colorList)
{
Console.WriteLine("\u001b[0m" + text14 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Underlined");
num = 0;
colorList = ANSICodeLists.HighIntensityUnderlineColorList;
foreach (string text15 in colorList)
{
Console.WriteLine("\u001b[0m" + text15 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Flashy");
num = 0;
colorList = ANSICodeLists.HighIntensityFlashyColorList;
foreach (string text16 in colorList)
{
Console.WriteLine("\u001b[0m" + text16 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Highlighter");
num = 0;
colorList = ANSICodeLists.HighIntensityHighlighterColorText;
foreach (string text17 in colorList)
{
Console.WriteLine("\u001b[0m" + text17 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Invisible");
num = 0;
colorList = ANSICodeLists.HighIntensityInvisibleColorText;
foreach (string text18 in colorList)
{
Console.WriteLine("\u001b[0m" + text18 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Strikethrough");
num = 0;
colorList = ANSICodeLists.HighIntensityStrikethroughColorText;
foreach (string text19 in colorList)
{
Console.WriteLine("\u001b[0m" + text19 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("High Intensity Background");
num = 0;
colorList = ANSICodeLists.HighInstensityBackgroundColorList;
foreach (string text20 in colorList)
{
Console.WriteLine("\u001b[0m" + text20 + $"Entry {num}" + "\u001b[0m");
num++;
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
public static void DisplayColor()
{
Console.WriteLine("Let's go over the Color's available in the Color Object with each mode available");
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Foreground, Regular Intensity");
for (int i = 0; i < 8; i++)
{
Color color = new Color(0, i);
string text = $"{color.Format()}Entry {i}: ";
for (int j = 0; j < 10; j++)
{
Color color2 = new Color(j, i);
text = text + color2.Format() + color2.GetTypeString() + color2.GetReset().Format() + " ";
}
Color color3 = new Color(21, i);
text = text + color3.Format() + color3.GetTypeString() + color3.GetReset().Format() + " ";
color3 = new Color(53, i);
text = text + color3.Format() + color3.GetTypeString() + color3.GetReset().Format() + " ";
color3 = new Color(51, i);
text = text + color3.Format() + color3.GetTypeString() + color3.GetReset().Format() + " ";
color3 = new Color(52, i);
text = text + color3.Format() + color3.GetTypeString() + color3.GetReset().Format() + " ";
Console.WriteLine(text + color.GetReset().Format());
if (i % 15 == 0 && i != 0)
{
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Foreground, High Intensity");
for (int k = 0; k < 8; k++)
{
Color color4 = new Color(0, k, background: false, highIntensity: true);
string text2 = $"{color4.Format()}Entry {k}: ";
for (int l = 0; l < 10; l++)
{
Color color5 = new Color(l, k, background: false, highIntensity: true);
text2 = text2 + color5.Format() + color5.GetTypeString() + color5.GetReset().Format() + " ";
}
Color color6 = new Color(21, k);
text2 = text2 + color6.Format() + color6.GetTypeString() + color6.GetReset().Format() + " ";
color6 = new Color(53, k);
text2 = text2 + color6.Format() + color6.GetTypeString() + color6.GetReset().Format() + " ";
color6 = new Color(51, k);
text2 = text2 + color6.Format() + color6.GetTypeString() + color6.GetReset().Format() + " ";
color6 = new Color(52, k);
text2 = text2 + color6.Format() + color6.GetTypeString() + color6.GetReset().Format() + " ";
Console.WriteLine(text2 + color4.GetReset().Format());
if (k % 15 == 0 && k != 0)
{
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Background, Regular Intensity");
for (int m = 0; m < 8; m++)
{
Color color7 = new Color(0, m, background: true);
string text3 = $"{color7.Format()}Entry {m}: ";
for (int n = 0; n < 10; n++)
{
Color color8 = new Color(n, m, background: true);
text3 = text3 + color8.Format() + color8.GetTypeString() + color8.GetReset().Format() + " ";
}
Color color9 = new Color(21, m);
text3 = text3 + color9.Format() + color9.GetTypeString() + color9.GetReset().Format() + " ";
color9 = new Color(53, m);
text3 = text3 + color9.Format() + color9.GetTypeString() + color9.GetReset().Format() + " ";
color9 = new Color(51, m);
text3 = text3 + color9.Format() + color9.GetTypeString() + color9.GetReset().Format() + " ";
color9 = new Color(52, m);
text3 = text3 + color9.Format() + color9.GetTypeString() + color9.GetReset().Format() + " ";
Console.WriteLine(text3 + color7.GetReset().Format());
if (m % 15 == 0 && m != 0)
{
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Background, High Intensity");
for (int num = 0; num < 8; num++)
{
Color color10 = new Color(0, num, background: true, highIntensity: true);
string text4 = $"{color10.Format()}Entry {num}: ";
for (int num2 = 0; num2 < 10; num2++)
{
Color color11 = new Color(num2, num, background: true, highIntensity: true);
text4 = text4 + color11.Format() + color11.GetTypeString() + color11.GetReset().Format() + " ";
}
Color color12 = new Color(21, num);
text4 = text4 + color12.Format() + color12.GetTypeString() + color12.GetReset().Format() + " ";
color12 = new Color(53, num);
text4 = text4 + color12.Format() + color12.GetTypeString() + color12.GetReset().Format() + " ";
color12 = new Color(51, num);
text4 = text4 + color12.Format() + color12.GetTypeString() + color12.GetReset().Format() + " ";
color12 = new Color(52, num);
text4 = text4 + color12.Format() + color12.GetTypeString() + color12.GetReset().Format() + " ";
Console.WriteLine(text4 + color10.GetReset().Format());
if (num % 15 == 0 && num != 0)
{
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
public static void DisplayColor256()
{
Console.WriteLine("Let's go over the Color's available in the Color256 Object with each mode available");
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Foreground");
for (int i = 0; i < 256; i++)
{
Color256 color = new Color256(0, i);
string text = $"{color.Format()}Entry {i}: ";
for (int j = 0; j < 10; j++)
{
Color256 color2 = new Color256(j, i);
text = text + color2.Format() + color2.GetTypeString() + color2.GetReset().Format() + " ";
}
Color256 color3 = new Color256(21, i);
text = text + color3.Format() + color3.GetTypeString() + color3.GetReset().Format() + " ";
color3 = new Color256(53, i);
text = text + color3.Format() + color3.GetTypeString() + color3.GetReset().Format() + " ";
color3 = new Color256(51, i);
text = text + color3.Format() + color3.GetTypeString() + color3.GetReset().Format() + " ";
color3 = new Color256(52, i);
text = text + color3.Format() + color3.GetTypeString() + color3.GetReset().Format() + " ";
Console.WriteLine(text + color.GetReset().Format());
if (i % 15 == 0 && i != 0)
{
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Background");
for (int k = 0; k < 256; k++)
{
Color256 color4 = new Color256(0, k, background: true);
string text2 = $"{color4.Format()}Entry {k}: ";
for (int l = 0; l < 10; l++)
{
Color256 color5 = new Color256(l, k, background: true);
text2 = text2 + color5.Format() + color5.GetTypeString() + color5.GetReset().Format() + " ";
}
Color256 color6 = new Color256(21, k);
text2 = text2 + color6.Format() + color6.GetTypeString() + color6.GetReset().Format() + " ";
color6 = new Color256(53, k);
text2 = text2 + color6.Format() + color6.GetTypeString() + color6.GetReset().Format() + " ";
color6 = new Color256(51, k);
text2 = text2 + color6.Format() + color6.GetTypeString() + color6.GetReset().Format() + " ";
color6 = new Color256(52, k);
text2 = text2 + color6.Format() + color6.GetTypeString() + color6.GetReset().Format() + " ";
Console.WriteLine(text2 + color4.GetReset().Format());
if (k % 15 == 0 && k != 0)
{
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
public static void DisplayColorRGB()
{
Console.WriteLine("Let's go over the Color's available in the Color256 Object with each mode available");
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Foreground");
for (int i = 0; i < 256; i++)
{
for (int j = 0; j < 256; j++)
{
for (int k = 0; k < 256; k++)
{
ColorRGB colorRGB = new ColorRGB(0, i, j, k);
string text = $"{colorRGB.Format()}Entry {i}, {j}, {k}: ";
for (int l = 0; l < 10; l++)
{
ColorRGB colorRGB2 = new ColorRGB(l, i, j, k);
text = text + colorRGB2.Format() + colorRGB2.GetTypeString() + colorRGB2.GetReset().Format() + " ";
}
ColorRGB colorRGB3 = new ColorRGB(21, i, j, k);
text = text + colorRGB3.Format() + colorRGB3.GetTypeString() + colorRGB3.GetReset().Format() + " ";
colorRGB3 = new ColorRGB(53, i, j, k);
text = text + colorRGB3.Format() + colorRGB3.GetTypeString() + colorRGB3.GetReset().Format() + " ";
colorRGB3 = new ColorRGB(51, i, j, k);
text = text + colorRGB3.Format() + colorRGB3.GetTypeString() + colorRGB3.GetReset().Format() + " ";
colorRGB3 = new ColorRGB(52, i, j, k);
text = text + colorRGB3.Format() + colorRGB3.GetTypeString() + colorRGB3.GetReset().Format() + " ";
Console.WriteLine(text + colorRGB.GetReset().Format());
}
}
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
Console.WriteLine("Background");
for (int m = 0; m < 256; m++)
{
for (int n = 0; n < 256; n++)
{
for (int num = 0; num < 256; num++)
{
ColorRGB colorRGB4 = new ColorRGB(0, m, n, num, background: true);
string text2 = $"{colorRGB4.Format()}Entry {m}, {n}, {num}: ";
for (int num2 = 0; num2 < 10; num2++)
{
ColorRGB colorRGB5 = new ColorRGB(num2, m, n, num, background: true);
text2 = text2 + colorRGB5.Format() + colorRGB5.GetTypeString() + colorRGB5.GetReset().Format() + " ";
}
ColorRGB colorRGB6 = new ColorRGB(21, m, n, num);
text2 = text2 + colorRGB6.Format() + colorRGB6.GetTypeString() + colorRGB6.GetReset().Format() + " ";
colorRGB6 = new ColorRGB(53, m, n, num);
text2 = text2 + colorRGB6.Format() + colorRGB6.GetTypeString() + colorRGB6.GetReset().Format() + " ";
colorRGB6 = new ColorRGB(51, m, n, num);
text2 = text2 + colorRGB6.Format() + colorRGB6.GetTypeString() + colorRGB6.GetReset().Format() + " ";
colorRGB6 = new ColorRGB(52, m, n, num);
text2 = text2 + colorRGB6.Format() + colorRGB6.GetTypeString() + colorRGB6.GetReset().Format() + " ";
Console.WriteLine(text2 + colorRGB4.GetReset().Format());
}
}
}
Console.WriteLine("Press Enter to Proceed");
Console.ReadLine();
}
}
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public class GetColorFromType
{
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static string GetColorFromInt(int x, string type = "Regular")
{
return (string)((object[])(type switch
{
"Regular" => ANSICodeLists.ColorList,
"Bold" => ANSICodeLists.BoldColorList,
"Darkened" => ANSICodeLists.DarkenedColorList,
"Italic" => ANSICodeLists.ItalicColorList,
"Underlined" => ANSICodeLists.UnderlineColorList,
"Flashy" => ANSICodeLists.FlashyColorList,
"Highlighter" => ANSICodeLists.HighlighterColorText,
"Invisible" => ANSICodeLists.InvisibleColorText,
"Strikethrough" => ANSICodeLists.StrikethroughColorText,
"Background" => ANSICodeLists.BackgroundColorList,
"HighIntensityRegular" => ANSICodeLists.HighIntensityColorList,
"HighIntensityBold" => ANSICodeLists.HighIntensityBoldColorList,
"HighIntensityDarkened" => ANSICodeLists.HighIntensityDarkenedColorList,
"HighIntensityItalic" => ANSICodeLists.HighIntensityItalicColorList,
"HighIntensityUnderlined" => ANSICodeLists.HighIntensityUnderlineColorList,
"HighIntensityFlashy" => ANSICodeLists.HighIntensityFlashyColorList,
"HighIntensityHighlighter" => ANSICodeLists.HighIntensityHighlighterColorText,
"HighIntensityInvisible" => ANSICodeLists.HighIntensityInvisibleColorText,
"HighIntensityStrikethrough" => ANSICodeLists.HighIntensityStrikethroughColorText,
"HighIntensityBackground" => ANSICodeLists.BackgroundColorList,
_ => ANSICodeLists.ColorList,
}))[x];
}
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static string GetColorFromString(string color, string type = "Regular")
{
int num = color switch
{
"Black" => 0,
"Red" => 1,
"Green" => 2,
"Yellow" => 3,
"Blue" => 4,
"Magenta" => 5,
"Cyan" => 6,
"White" => 7,
_ => 7,
};
return (string)((object[])(type switch
{
"Regular" => ANSICodeLists.ColorList,
"Bold" => ANSICodeLists.BoldColorList,
"Darkened" => ANSICodeLists.DarkenedColorList,
"Italic" => ANSICodeLists.ItalicColorList,
"Underlined" => ANSICodeLists.UnderlineColorList,
"Flashy" => ANSICodeLists.FlashyColorList,
"Highlighter" => ANSICodeLists.HighlighterColorText,
"Invisible" => ANSICodeLists.InvisibleColorText,
"Strikethrough" => ANSICodeLists.StrikethroughColorText,
"Background" => ANSICodeLists.BackgroundColorList,
"HighIntensityRegular" => ANSICodeLists.HighIntensityColorList,
"HighIntensityBold" => ANSICodeLists.HighIntensityBoldColorList,
"HighIntensityDarkened" => ANSICodeLists.HighIntensityDarkenedColorList,
"HighIntensityItalic" => ANSICodeLists.HighIntensityItalicColorList,
"HighIntensityUnderlined" => ANSICodeLists.HighIntensityUnderlineColorList,
"HighIntensityFlashy" => ANSICodeLists.HighIntensityFlashyColorList,
"HighIntensityHighlighter" => ANSICodeLists.HighIntensityHighlighterColorText,
"HighIntensityInvisible" => ANSICodeLists.HighIntensityInvisibleColorText,
"HighIntensityStrikethrough" => ANSICodeLists.HighIntensityStrikethroughColorText,
"HighIntensityBackground" => ANSICodeLists.BackgroundColorList,
_ => ANSICodeLists.ColorList,
}))[num];
}
}
public class GetDigitStart
{
public static int GetDigitStartColor(bool background, bool highIntensity)
{
int result = 0;
if (background && highIntensity)
{
result = 10;
}
else if (background && !highIntensity)
{
result = 4;
}
else if (!background && highIntensity)
{
result = 9;
}
else if (!background && !highIntensity)
{
result = 3;
}
return result;
}
public static int GetDigitStartColorBase(bool background)
{
int result = 0;
if (background)
{
result = 4;
}
else if (!background)
{
result = 3;
}
return result;
}
}
}
namespace Cecil_Libraries.ANSI_Utils.Objects
{
public class Color : ColorBase
{
public int BaseColor { get; set; }
public bool HighIntensity { get; set; }
public Color(string type, string color, bool background = false, bool highIntensity = false, bool reset = false)
{
base.Background = background;
HighIntensity = highIntensity;
base.Reset = reset;
int digitStartColor = GetDigitStart.GetDigitStartColor(base.Background, HighIntensity);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchString(base.Reset, type);
(base.BasicShade, BaseColor) = ColorTypeSwitch.SwitchColorString(color, digitStartColor);
}
public Color(int type, string color, bool background = false, bool highIntensity = false, bool reset = false)
{
base.Background = background;
HighIntensity = highIntensity;
base.Reset = reset;
int digitStartColor = GetDigitStart.GetDigitStartColor(base.Background, HighIntensity);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchInt(base.Reset, type);
(base.BasicShade, BaseColor) = ColorTypeSwitch.SwitchColorString(color, digitStartColor);
}
public Color(string type, int color, bool background = false, bool highIntensity = false, bool reset = false)
{
base.Background = background;
HighIntensity = highIntensity;
base.Reset = reset;
int digitStartColor = GetDigitStart.GetDigitStartColor(base.Background, HighIntensity);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchString(base.Reset, type);
(base.BasicShade, BaseColor) = ColorTypeSwitch.SwitchColorInt(color, digitStartColor);
}
public Color(int type, int color, bool background = false, bool highIntensity = false, bool reset = false)
{
base.Background = background;
HighIntensity = highIntensity;
base.Reset = reset;
int digitStartColor = GetDigitStart.GetDigitStartColor(base.Background, HighIntensity);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchInt(base.Reset, type);
(base.BasicShade, BaseColor) = ColorTypeSwitch.SwitchColorInt(color, digitStartColor);
}
public Color GetReset()
{
return new Color(base.Type, BaseColor, base.Background, HighIntensity, reset: true);
}
public Color GetTypeVariant(string type)
{
return new Color(type, BaseColor, base.Background, HighIntensity, base.Reset);
}
public Color GetTypeVariant(int type)
{
return new Color(type, BaseColor, base.Background, HighIntensity, base.Reset);
}
public Color GetColorVariant(string colorStr)
{
return new Color(base.Type, colorStr, base.Background, HighIntensity, base.Reset);
}
public Color GetColorVariant(int colorInt)
{
return new Color(base.Type, colorInt, base.Background, HighIntensity, base.Reset);
}
public void ToggleHighIntensity()
{
HighIntensity = !HighIntensity;
}
}
public class Color256 : ColorBase
{
public int Shade256 { get; set; }
public Color256(string type, int shade, bool background = false, bool reset = false)
{
base.Background = background;
base.Reset = reset;
int digitStartColorBase = GetDigitStart.GetDigitStartColorBase(base.Background);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchString(base.Reset, type);
(int, int) tuple = ColorTypeSwitch.SwitchColor256Int(shade, digitStartColorBase);
base.BasicShade = tuple.Item1;
Shade256 = tuple.Item2;
base.Extra = ";5;" + Shade256;
}
public Color256(int type, int shade, bool background = false, bool reset = false)
{
base.Background = background;
base.Reset = reset;
int digitStartColorBase = GetDigitStart.GetDigitStartColorBase(base.Background);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchInt(base.Reset, type);
(int, int) tuple = ColorTypeSwitch.SwitchColor256Int(shade, digitStartColorBase);
base.BasicShade = tuple.Item1;
Shade256 = tuple.Item2;
base.Extra = ";5;" + Shade256;
}
public Color256 GetReset()
{
return new Color256(base.Type, Shade256, base.Background, reset: true);
}
public Color256 GetTypeVariant(string type)
{
return new Color256(type, Shade256, base.Background, base.Reset);
}
public Color256 GetTypeVariant(int type)
{
return new Color256(type, Shade256, base.Background, base.Reset);
}
public Color256 GetColorVariant(int shade)
{
return new Color256(base.Type, shade, base.Background, base.Reset);
}
}
public class ColorBase
{
public string BaseString = "\u001b[";
public int Type { get; set; }
public int BasicShade { get; set; }
public bool Reset { get; set; }
public bool Background { get; set; }
public string Extra { get; set; }
public string Format()
{
if (Reset && Type == 0 && ((BasicShade.ToString().Length == 2 && BasicShade.ToString().StartsWith("3")) || (BasicShade.ToString().Length == 2 && BasicShade.ToString().StartsWith("9"))))
{
return "\u001b[39m";
}
if (Reset && Type == 0 && ((BasicShade.ToString().Length == 2 && BasicShade.ToString().StartsWith("4")) || (BasicShade.ToString().Length == 3 && BasicShade.ToString().StartsWith("10"))))
{
return "\u001b[49m";
}
return BaseString + Type + ";" + BasicShade + ((!string.IsNullOrWhiteSpace(Extra)) ? Extra : "") + "m";
}
public string GetTypeString()
{
return Type switch
{
0 => "Regular",
1 => "Bold",
2 => "Dulled",
3 => "Italic",
4 => "Underlined",
5 => "Blink",
6 => "Rapid",
7 => "Highlight",
8 => "Underlight",
9 => "Strikethrough",
21 => "Doubleline",
53 => "Overlined",
51 => "Framed",
52 => "Encircled",
_ => $"Failed to get a Valid Type please verify {Type}, if its valid contact @thincreator3483 on discord.",
};
}
public void ToggleBackground()
{
Background = !Background;
}
}
public class ColorRGB : ColorBase
{
public int Red { get; set; }
public int Green { get; set; }
public int Blue { get; set; }
public ColorRGB(string type, int red, int green, int blue, bool background = false, bool reset = false)
{
base.Background = background;
base.Reset = reset;
int digitStartColorBase = GetDigitStart.GetDigitStartColorBase(base.Background);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchString(base.Reset, type);
(int, int, int, int) tuple = ColorTypeSwitch.SwitchColorRGBInt(red, green, blue, digitStartColorBase);
base.BasicShade = tuple.Item1;
Red = tuple.Item2;
Green = tuple.Item3;
Blue = tuple.Item4;
base.Extra = ";2;" + Red + ";" + Green + ";" + Blue;
}
public ColorRGB(int type, int red, int green, int blue, bool background = false, bool reset = false)
{
base.Background = background;
base.Reset = reset;
int digitStartColorBase = GetDigitStart.GetDigitStartColorBase(base.Background);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchInt(base.Reset, type);
(int, int, int, int) tuple = ColorTypeSwitch.SwitchColorRGBInt(red, green, blue, digitStartColorBase);
base.BasicShade = tuple.Item1;
Red = tuple.Item2;
Green = tuple.Item3;
Blue = tuple.Item4;
base.Extra = ";2;" + Red + ";" + Green + ";" + Blue;
}
public ColorRGB(string type, (int red, int green, int blue) rgbPair, bool background = false, bool reset = false)
{
base.Background = background;
base.Reset = reset;
int digitStartColorBase = GetDigitStart.GetDigitStartColorBase(base.Background);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchString(base.Reset, type);
(int, int, int, int) tuple = ColorTypeSwitch.SwitchColorRGBInt(rgbPair.red, rgbPair.green, rgbPair.blue, digitStartColorBase);
base.BasicShade = tuple.Item1;
Red = tuple.Item2;
Green = tuple.Item3;
Blue = tuple.Item4;
base.Extra = ";2;" + Red + ";" + Green + ";" + Blue;
}
public ColorRGB(int type, (int red, int green, int blue) rgbPair, bool background = false, bool reset = false)
{
base.Background = background;
base.Reset = reset;
int digitStartColorBase = GetDigitStart.GetDigitStartColorBase(base.Background);
base.Type = ColorBaseTypeSwitch.ColorBaseTypeSwitchInt(base.Reset, type);
(int, int, int, int) tuple = ColorTypeSwitch.SwitchColorRGBInt(rgbPair.red, rgbPair.green, rgbPair.blue, digitStartColorBase);
base.BasicShade = tuple.Item1;
Red = tuple.Item2;
Green = tuple.Item3;
Blue = tuple.Item4;
base.Extra = ";2;" + Red + ";" + Green + ";" + Blue;
}
public ColorRGB GetReset()
{
return new ColorRGB(base.Type, Red, Green, Blue, base.Background, reset: true);
}
public ColorRGB GetTypeVariant(string type)
{
return new ColorRGB(type, Red, Green, Blue, base.Background, base.Reset);
}
public ColorRGB GetTypeVariant(int type)
{
return new ColorRGB(type, Red, Green, Blue, base.Background, base.Reset);
}
public ColorRGB GetColorVariant(int red, int green, int blue)
{
return new ColorRGB(base.Type, red, green, blue, base.Background, base.Reset);
}
public ColorRGB GetColorVariant((int red, int green, int blue) rgbPair)
{
return new ColorRGB(base.Type, rgbPair.red, rgbPair.green, rgbPair.blue, base.Background, base.Reset);
}
}
}
namespace Cecil_Libraries.ANSI_Utils.Lists
{
public class ANSICodeLists
{
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] ColorList = new string[8] { "\u001b[0;30m", "\u001b[0;31m", "\u001b[0;32m", "\u001b[0;33m", "\u001b[0;34m", "\u001b[0;35m", "\u001b[0;36m", "\u001b[0;37m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] BoldColorList = new string[8] { "\u001b[1;30m", "\u001b[1;31m", "\u001b[1;32m", "\u001b[1;33m", "\u001b[1;34m", "\u001b[1;35m", "\u001b[1;36m", "\u001b[1;37m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] DarkenedColorList = new string[8] { "\u001b[2;30m", "\u001b[2;31m", "\u001b[2;32m", "\u001b[2;33m", "\u001b[2;34m", "\u001b[2;35m", "\u001b[2;36m", "\u001b[2;37m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] ItalicColorList = new string[8] { "\u001b[3;30m", "\u001b[3;31m", "\u001b[3;32m", "\u001b[3;33m", "\u001b[3;34m", "\u001b[3;35m", "\u001b[3;36m", "\u001b[3;37m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] UnderlineColorList = new string[8] { "\u001b[4;30m", "\u001b[4;31m", "\u001b[4;32m", "\u001b[4;33m", "\u001b[4;34m", "\u001b[4;35m", "\u001b[4;36m", "\u001b[4;37m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] FlashyColorList = new string[8] { "\u001b[5;30m", "\u001b[5;31m", "\u001b[5;32m", "\u001b[5;33m", "\u001b[5;34m", "\u001b[5;35m", "\u001b[5;36m", "\u001b[5;37m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighlighterColorText = new string[8] { "\u001b[7;30m", "\u001b[7;31m", "\u001b[7;32m", "\u001b[7;33m", "\u001b[7;34m", "\u001b[7;35m", "\u001b[7;36m", "\u001b[7;37m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] InvisibleColorText = new string[8] { "\u001b[8;30m", "\u001b[8;31m", "\u001b[8;32m", "\u001b[8;33m", "\u001b[8;34m", "\u001b[8;35m", "\u001b[8;36m", "\u001b[8;37m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] StrikethroughColorText = new string[8] { "\u001b[9;30m", "\u001b[9;31m", "\u001b[9;32m", "\u001b[9;33m", "\u001b[9;34m", "\u001b[9;35m", "\u001b[9;36m", "\u001b[9;37m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] BackgroundColorList = new string[8] { "\u001b[40m", "\u001b[41m", "\u001b[42m", "\u001b[43m", "\u001b[44m", "\u001b[45m", "\u001b[46m", "\u001b[47m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighInstensityBackgroundColorList = new string[8] { "\u001b[0;100m", "\u001b[0;101m", "\u001b[0;102m", "\u001b[0;103m", "\u001b[0;104m", "\u001b[0;105m", "\u001b[0;106m", "\u001b[0;107m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighIntensityColorList = new string[8] { "\u001b[0;90m", "\u001b[0;91m", "\u001b[0;92m", "\u001b[0;93m", "\u001b[0;94m", "\u001b[0;95m", "\u001b[0;96m", "\u001b[0;97m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighIntensityBoldColorList = new string[8] { "\u001b[1;90m", "\u001b[1;91m", "\u001b[1;92m", "\u001b[1;93m", "\u001b[1;94m", "\u001b[1;95m", "\u001b[1;96m", "\u001b[1;97m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighIntensityDarkenedColorList = new string[8] { "\u001b[2;90m", "\u001b[2;91m", "\u001b[2;92m", "\u001b[2;93m", "\u001b[2;94m", "\u001b[2;95m", "\u001b[2;96m", "\u001b[2;97m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighIntensityItalicColorList = new string[8] { "\u001b[9;90m", "\u001b[9;91m", "\u001b[9;92m", "\u001b[9;93m", "\u001b[9;94m", "\u001b[9;95m", "\u001b[9;96m", "\u001b[9;97m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighIntensityUnderlineColorList = new string[8] { "\u001b[4;90m", "\u001b[4;91m", "\u001b[4;92m", "\u001b[4;93m", "\u001b[4;94m", "\u001b[4;95m", "\u001b[4;96m", "\u001b[4;97m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighIntensityFlashyColorList = new string[8] { "\u001b[5;90m", "\u001b[5;91m", "\u001b[5;92m", "\u001b[5;93m", "\u001b[5;94m", "\u001b[5;95m", "\u001b[5;96m", "\u001b[5;97m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighIntensityHighlighterColorText = new string[8] { "\u001b[7;90m", "\u001b[7;91m", "\u001b[7;92m", "\u001b[7;93m", "\u001b[7;94m", "\u001b[7;95m", "\u001b[7;96m", "\u001b[7;97m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighIntensityInvisibleColorText = new string[8] { "\u001b[8;90m", "\u001b[8;91m", "\u001b[8;92m", "\u001b[8;93m", "\u001b[8;94m", "\u001b[8;95m", "\u001b[8;96m", "\u001b[8;97m" };
[Obsolete("Hey, we are going to recommend you use the Color Object system instead, this code is Obsolete.")]
public static readonly string[] HighIntensityStrikethroughColorText = new string[8] { "\u001b[9;90m", "\u001b[9;91m", "\u001b[9;92m", "\u001b[9;93m", "\u001b[9;94m", "\u001b[9;95m", "\u001b[9;96m", "\u001b[9;97m" };
public const string ResetColor = "\u001b[0m";
public const string ResetForeground = "\u001b[39m";
public const string ResetBackground = "\u001b[49m";
}
}