Global list of colour names and colour values

Hi all,

This seems like such a simple problem, I’m not quite sure why I can’t figure it out.

I need to have a global immutable list(?) of colours with a string identifier. E.g.

{"Lime", new Color( 166, 254, 0 )},
{"Green", new Color( 166, 254, 0 )},
{"Aqua", new Color( 166, 254, 0 )}

I then need to be able to add a variable with a dropdown to various scripts, which would allow me to select Lime, Green, Aqua etc. I could then retrieve that colour value from the set variable.

Any help would be really great!

So I opted for creating a class which contained an enum for the colour list, a hashtable to store colour values, and a function to cross check them.

public class HueColour {

	public enum HueColorNames{
		Lime,
		Green,
		Aqua,
		Blue,
		Navy,
		Purple,
		Pink,
		Red,
		Orange,
		Yellow
	}

	private static Hashtable hueColourValues = new Hashtable{
		{ HueColorNames.Lime, 	new Color32( 166 , 254 , 0, 1 ) },
		{ HueColorNames.Green, 	new Color32( 0 , 254 , 111, 1 ) },
		{ HueColorNames.Aqua, 	new Color32( 0 , 201 , 254, 1 ) },
		{ HueColorNames.Blue, 	new Color32( 0 , 122 , 254, 1 ) },
		{ HueColorNames.Navy, 	new Color32( 60 , 0 , 254, 1 ) },
		{ HueColorNames.Purple, new Color32( 143 , 0 , 254, 1 ) },
		{ HueColorNames.Pink, 	new Color32( 232 , 0 , 254, 1 ) },
		{ HueColorNames.Red, 	new Color32( 254 , 9 , 0, 1 ) },
		{ HueColorNames.Orange, new Color32( 254 , 161 , 0, 1 ) },
		{ HueColorNames.Yellow, new Color32( 254 , 224 , 0, 1 ) },
	};

	public static Color32 HueColourValue( HueColorNames color ) {
		return (Color32) hueColourValues ;
	}

}

Not sure if this is the best way, but it’s working.