Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Color[] OrderColorByHue(List<string> colors)
- {
- foreach(string c in colors)
- {
- Color color = ColorFromString(c); // This was defined in another question of mine :)
- float hue = color.GetHue();
- hueColors.Add(new KeyValuePair<Color, float>(color, hue));
- }
- hueColors.Sort((color1, color2) => color2.Value.CompareTo(color1.Value));
- Color[] value = hueColors.Select(color => color.Key).ToArray();
- return value;
- }
- // GET: Admin/Colors
- public ActionResult Index()
- {
- var colors = db.Colors.OrderBy(a => a.HexCode);
- return View(colors);
- }
Add Comment
Please, Sign In to add comment