/// <summary> /// Obtains a color from the extended palette, if not present obtains it from the default palette, in the extreme case it uses Pink as a signal that a color is missing /// </summary> /// <param name="colorKey"></param> /// <returns></returns> public Color getColor(string colorKey) { var retColor = ExtColorPalette.ContainsKey(colorKey) ? ExtColorPalette[colorKey]:Color.Empty; //Invisible colors are not good, might indicate missing color from the palette as is represented by 00000000 if (retColor != Color.Empty && retColor.A != 0) { return(retColor); } if (DefaultColorPalette != null) { retColor = DefaultColorPalette.ContainsKey(colorKey) ? DefaultColorPalette[colorKey] : Color.Empty; } //why are we here?, just avoid a crash if (retColor == Color.Empty) { //Fail to pink , because why not retColor = Color.Pink; } return(retColor); }
/// <summary> /// Add a color to the extended palette /// </summary> /// <param name="colorKey"></param> /// <param name="inColor"></param> public void addColor(string colorKey, Color inColor) { ExtColorPalette.Add(colorKey, inColor); }