1let element = document.querySelector('.preset');
2let style = getComputedStyle(element);
3let bg = style.backgroundColor;
1public static Dictionary<string, object> DictionaryFromType(object atype)
2{
3 if (atype == null) return new Dictionary<string, object>();
4 Type t = atype.GetType();
5 PropertyInfo[] props = t.GetProperties();
6 Dictionary<string, object> dict = new Dictionary<string, object>();
7 foreach (PropertyInfo prp in props)
8 {
9 object value = prp.GetValue(atype, new object[]{});
10 dict.Add(prp.Name, value);
11 }
12 return dict;
13}
14