I'm trying to find a way to add colors to a "palette". The worst part of not learning computer science is that it is hard to word questions. I've been searching for adding enumerations in a class during run time. Because ideally, I can do a Console.ReadLine() to add a new color.
class Program
{
static void Main(string[] args)
{
Color _Color = new Color();
Console.WriteLine(Palette.Black);
// _Color.addColor(Console.ReadLine(), Console.ReadLine());
Console.ReadKey();
}
}
public class Palette
{
private readonly string color;
public static readonly Palette Black = new Palette("black");
public static readonly Palette Red = new Palette("red");
public static readonly Palette Green = new Palette("green");
public static readonly Palette Blue = new Palette("blue");
//I want to be able to create new colors by using the Color.addColor() method
private Palette(string inputColor) { this.color = inputColor; }
public override string ToString() { return this.color; }
}
public class Color
{
public void addColor(string colorName, string color)
{
//create a new color into Palette using form:
// public static readonly Palette colorName = new Palette("color");
}
}
I want to be able to do Console.WriteLine(Palette.Yellow) after inputting into the Console that I want to add the color yellow into the palette.