public void SetColors(Dictionary<string, Color> colors) { foreach (var colorVariable in colors) { if (GetType().GetProperty(colorVariable.Key) != null) { var prop = GetType().GetProperty(colorVariable.Key); prop.SetValue(this, colorVariable.Value); } } }