IEnumerable <CodedColor> GetOrderedColors() { switch (orderMode) { case ColorsOrderMode.Symbol: return(Palette.OrderBySymbol()); case ColorsOrderMode.Darkness: return(Palette.OrderByDarknes().Cast <CodedColor>()); case ColorsOrderMode.Code: return(Palette.OrderByCode()); case ColorsOrderMode.Name: return(Palette.Cast <CodedColor>().OrderBy(c => c.ColorName)); case ColorsOrderMode.Count: return(Palette.OrderByCount().Cast <CodedColor>()); case ColorsOrderMode.SymbolDesc: return(Palette.OrderBySymbol(true)); case ColorsOrderMode.DarknessDesc: return(Palette.OrderByDarknes(true).Cast <CodedColor>()); case ColorsOrderMode.CountDesc: return(Palette.OrderByCount(true).Cast <CodedColor>()); case ColorsOrderMode.CodeDesc: return(Palette.OrderByCode(true)); case ColorsOrderMode.NameDesc: return(Palette.Cast <CodedColor>().OrderByDescending(c => c.ColorName)); case ColorsOrderMode.Selected: return(Palette.Cast <CodedColor>().OrderBy(c => c.Hidden)); case ColorsOrderMode.SelectedDesc: return(Palette.Cast <CodedColor>().OrderBy(c => !c.Hidden)); case ColorsOrderMode.Distance: return(TargetColor != null?Palette.OrderByDiff(TargetColor, UseVisualColorDiff).Cast <CodedColor>() : Palette); case ColorsOrderMode.DistanceDesc: return(TargetColor != null?Palette.OrderByDiff(TargetColor, UseVisualColorDiff, true).Cast <CodedColor>() : Palette); default: return(Palette); } }